save: directe uploadMeasurement push, verwijder syncStatus uit MeasurementForm
This commit is contained in:
parent
23db445366
commit
143572bc81
2 changed files with 2 additions and 3 deletions
|
|
@ -78,7 +78,6 @@ function toInt(s: string): number {
|
|||
measuredAt: measurementDate.toISOString(),
|
||||
createdAt: isEdit && initialValues?.createdAt ? initialValues.createdAt : now,
|
||||
updatedAt: now,
|
||||
syncStatus: 'local',
|
||||
}
|
||||
onSubmit(m)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { useFocusEffect } from '@react-navigation/native'
|
|||
import MeasurementForm from '../components/MeasurementForm'
|
||||
import { Measurement } from '../types'
|
||||
import { initDatabase, insertMeasurement, upsertMeasurement, getLatestMeasurement, getMeasurementByDate } from '../database/db'
|
||||
import { uploadMeasurement } from '../sync/syncService'
|
||||
|
||||
type Props = {
|
||||
navigation: any
|
||||
|
|
@ -72,8 +73,7 @@ export default function NewMeasurementScreen({ navigation, route }: Props) {
|
|||
|
||||
const doSave = async (m: Measurement) => {
|
||||
try {
|
||||
const { syncAll } = await import('../sync/syncService')
|
||||
await syncAll()
|
||||
await uploadMeasurement(m)
|
||||
Alert.alert('Opgeslagen & gesynct', 'Meting is opgeslagen en gesynchroniseerd', [
|
||||
{ text: 'OK', onPress: () => navigation.goBack() },
|
||||
])
|
||||
|
|
|
|||
Loading…
Reference in a new issue