Skip to content

Commit 059261a

Browse files
committed
fix: show toast on errors with empty response
Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
1 parent 11db3a6 commit 059261a

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/views/Submit.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -818,12 +818,18 @@ export default {
818818
this.deleteFormFieldFromLocalStorage()
819819
emit('forms:last-updated:set', this.form.id)
820820
} catch (error) {
821+
const errorMessage = error.response?.data?.ocs?.meta?.message
821822
logger.error('Error while submitting the form', { error })
822-
showError(
823-
t('forms', 'There was an error submitting the form: {message}', {
824-
message: error.response.data.ocs.meta.message,
825-
}),
826-
)
823+
if(errorMessage) {
824+
showError(
825+
t('forms', 'There was an error submitting the form: {message}', {
826+
message: errorMessage,
827+
}),
828+
)
829+
} else {
830+
showError(t('forms', 'There was an error submitting the form'))
831+
}
832+
827833
} finally {
828834
this.loading = false
829835
if (!this.publicView) {

0 commit comments

Comments
 (0)