Skip to content

Commit

Permalink
ON-40097 # Changed result from uploadFormSubmissionDraft()
Browse files Browse the repository at this point in the history
  • Loading branch information
mymattcarroll committed May 8, 2024
1 parent 261cbe4 commit 06ff28c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions src/OneBlinkUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class OneBlinkUploader {
taskId,
taskActionId,
taskGroupInstanceId,
draftId,
formSubmissionDraftId,
recaptchas = [],
onProgress,
abortSignal,
Expand All @@ -84,7 +84,7 @@ export default class OneBlinkUploader {
token: string
}[]
/** The identifier of the draft to mark as submitted. */
draftId?: string
formSubmissionDraftId?: string
}) {
const newS3SubmissionData: SubmissionTypes.NewS3SubmissionData = {
submission,
Expand Down Expand Up @@ -119,7 +119,7 @@ export default class OneBlinkUploader {
jobId,
previousFormSubmissionApprovalId,
recaptchas,
draftId,
formSubmissionDraftId,
},
})
}
Expand Down Expand Up @@ -224,18 +224,21 @@ export default class OneBlinkUploader {
taskId,
taskActionId,
taskGroupInstanceId,
draftId,
formSubmissionDraftId,
createdAt,
title,
lastElementUpdated,
localKey,
onProgress,
abortSignal,
}: UploadFormSubmissionOptions & {
/**
* The identifier of the draft that a new version should be created for. Set
* to `undefined` to create a new draft.
*/
draftId?: string
formSubmissionDraftId?: string
/** The identifier used to store the draft locally for offline capability */
localKey: string
/**
* The date and time (in ISO format) when the draft data was saved by a
* user.
Expand All @@ -259,11 +262,11 @@ export default class OneBlinkUploader {
})

let key = 'form-submission-drafts'
if (draftId) {
key += `/${draftId}`
if (formSubmissionDraftId) {
key += `/${formSubmissionDraftId}`
}

return await uploadToS3<SubmissionTypes.FormSubmissionDraft>({
return await uploadToS3<SubmissionTypes.FormSubmissionDraftVersion>({
...this,
contentType: 'application/json',
body: JSON.stringify(newS3SubmissionData),
Expand All @@ -280,6 +283,7 @@ export default class OneBlinkUploader {
taskGroupInstanceId,
jobId,
previousFormSubmissionApprovalId,
localKey,
createdAt,
title,
},
Expand Down

0 comments on commit 06ff28c

Please sign in to comment.