Skip to content

Commit

Permalink
chore: drop fallback to encrypt mode entirely (#6912)
Browse files Browse the repository at this point in the history
* chore: drop fallback to encrypt mode entirely

* chore: do not require network error test for storage mode

* chore: remove unused imports

* chore: remove unused imports on publicformservice

---------

Co-authored-by: Ken <[email protected]>
  • Loading branch information
tshuli and KenLSM committed Dec 12, 2023
1 parent 60769e1 commit fe52cb1
Showing 1 changed file with 39 additions and 50 deletions.
89 changes: 39 additions & 50 deletions frontend/src/features/public-form/PublicFormProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -540,55 +540,49 @@ export const PublicFormProvider = ({

// TODO (FRM-1413): Move to main return statement once virus scanner has been fully rolled out
if (enableVirusScanner) {
return submitStorageModeClearFormWithVirusScanningMutation
.mutateAsync(
{
...formData,
...formPaymentData,
},
{
onSuccess: ({
submissionId,
return submitStorageModeClearFormWithVirusScanningMutation.mutateAsync(
{
...formData,
...formPaymentData,
},
{
onSuccess: ({
submissionId,
timestamp,
// payment forms will have non-empty paymentData field
paymentData,
}) => {
trackSubmitForm(form)

if (paymentData) {
navigate(getPaymentPageUrl(formId, paymentData.paymentId))
storePaymentMemory(paymentData.paymentId)
return
}
setSubmissionData({
id: submissionId,
timestamp,
// payment forms will have non-empty paymentData field
paymentData,
}) => {
trackSubmitForm(form)

if (paymentData) {
navigate(getPaymentPageUrl(formId, paymentData.paymentId))
storePaymentMemory(paymentData.paymentId)
return
}
setSubmissionData({
id: submissionId,
timestamp,
})
},
})
},
)
.catch(async (error) => {
// TODO(#5826): Remove when we have resolved the Network Error
datadogLogs.logger.warn(
`handleSubmitForm: submit with virus scan`,
{
meta: {
...logMeta,
responseMode: 'storage',
method: 'axios',
error,
onError: (error) => {
// TODO(#5826): Remove when we have resolved the Network Error
datadogLogs.logger.warn(
`handleSubmitForm: submit with virus scan`,
{
meta: {
...logMeta,
responseMode: 'storage',
method: 'axios',
error,
},
},
},
)
)

if (/Network Error/i.test(error.message)) {
axiosDebugFlow()
// defaults to the safest option of storage submission without virus scanning
return submitStorageFormWithFetch()
} else {
showErrorToast(error, form)
}
})
},
},
)
}

return (
Expand Down Expand Up @@ -633,14 +627,9 @@ export const PublicFormProvider = ({
},
},
})

axiosDebugFlow()
if (/Network Error/i.test(error.message)) {
axiosDebugFlow()
// defaults to the safest option of storage submission without virus scanning
return submitStorageFormWithFetch()
} else {
showErrorToast(error, form)
}
return submitStorageFormWithFetch()
})
)
}
Expand Down

0 comments on commit fe52cb1

Please sign in to comment.