@oneblink/apps-react
    Preparing search index...

    Function upsertDraft

    • Create or update a Draft in the local store and sync it with remote drafts. Will also handle cleaning up auto save data (if the autoSaveKey property is passed).

      const abortController = new AbortController()
      const formSubmissionDraftId = 'd3aeb944-d0b3-11ea-87d0-0242ac130003' // pass `undefined` to create a new draft
      const autoSaveKey = 'SET ME TO DELETE AUTOSAVE DATA AFTER SAVING DRAFT'
      const draftSubmissionInput = {
      title: 1,
      formsAppId: 1,
      submission: {
      form: 'data',
      goes: 'here',
      },
      definition: {
      form: 'definition',
      goes: 'here',
      },
      }
      await draftService.upsertDraft({
      formSubmissionDraftId,
      autoSaveKey,
      draftSubmissionInput,
      abortSignal: abortController.signal,
      onProgress: (progress) => {
      // ...
      },
      })

      Parameters

      • options: {
            abortSignal?: AbortSignal;
            autoSaveKey?: string;
            draftSubmissionInput: DraftSubmissionInput;
            formSubmissionDraftId: string | undefined;
            onProgress?: ProgressListener;
            pendingTimestamp?: string;
        }

      Returns Promise<void>