diff --git a/app/javascript/submission_form/kba_step.vue b/app/javascript/submission_form/kba_step.vue index 253b9636..03c7431a 100644 --- a/app/javascript/submission_form/kba_step.vue +++ b/app/javascript/submission_form/kba_step.vue @@ -497,10 +497,10 @@ export default { body: JSON.stringify(payload) }) - if (!resp.ok) throw new Error('Failed to start KBA') - const data = await resp.json() + if (!resp.ok) throw new Error(data.error || 'Failed to start KBA') + if (data.result && data.result.action === 'FAIL') { if (data.result.detail === 'NO MATCH') { throw new Error('Unfortunately, we were unable to start Knowledge Based Authentication with the details provided. Please review and confirm that all your personal details are correct.')