Skip to content

Commit

Permalink
[#1153] Add on sync click
Browse files Browse the repository at this point in the history
  • Loading branch information
navins94 committed Feb 9, 2024
1 parent 8cb1c8d commit 4b39bd7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/src/pages/ManageForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { UIState, FormState } from '../store';
import { i18n, api } from '../lib';
import { getCurrentTimestamp } from '../form/lib';
import { crudMonitoring } from '../database/crud';
import crudJobs, { SYNC_DATAPOINT_JOB_NAME } from '../database/crud/crud-jobs';

const ManageForm = ({ navigation, route }) => {
const draftCount = FormState.useState((s) => s.form?.draft);
Expand Down Expand Up @@ -105,6 +106,15 @@ const ManageForm = ({ navigation, route }) => {
}
};

const handleOnSyncClick = async () => {
await crudJobs.addJob({
form: route.params.formId,
user: userId,
type: SYNC_DATAPOINT_JOB_NAME,
status: jobStatus.PENDING,
});
};

return (
<BaseLayout title={route?.params?.name} rightComponent={false}>
<BaseLayout.Content>
Expand All @@ -127,7 +137,7 @@ const ManageForm = ({ navigation, route }) => {
</View>
</BaseLayout.Content>
<View style={{ paddingHorizontal: 16, paddingBottom: 16 }}>
<Button title={trans.syncDataPointBtn} type="outline" />
<Button title={trans.syncDataPointBtn} type="outline" onPress={handleOnSyncClick} />
</View>
</BaseLayout>
);
Expand Down

0 comments on commit 4b39bd7

Please sign in to comment.