CASH-2563: Update bailout navigation blocking

This commit is contained in:
credelinghuys 2026-05-15 10:18:00 -04:00
parent f0d806accb
commit ddcd8e5cf4

View file

@ -76,15 +76,17 @@ export async function beforeEach(to, from) {
} }
// Block navigation if an order has been submitted. // Block navigation if an order has been submitted.
if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) { const submittedState = window.sessionStorage.getItem(
const exceptionPages = [ sessionStorageKeyConstants.SUBMITTED_STATE
FUNNEL_START_PAGE.name, );
routeData.CONFIRMATION.name, if (submittedState !== null) {
routeData.BAILOUT_SUCCESS.name, const isBailout = getIsBailout(submittedState);
]; const exceptionPages = isBailout
? [FUNNEL_START_PAGE.name, routeData.BAILOUT_SUCCESS.name]
: [FUNNEL_START_PAGE.name, routeData.CONFIRMATION.name];
if (!exceptionPages.some((name) => to.name === name) && !isVirtualRoute(to.name)) { if (!exceptionPages.some((name) => to.name === name) && !isVirtualRoute(to.name)) {
if (to.name === routeData.BAILOUT.name) { if (isBailout) {
router.push({ router.push({
name: routeData.BAILOUT_SUCCESS.name, name: routeData.BAILOUT_SUCCESS.name,
}); });
@ -153,3 +155,8 @@ export async function beforeEach(to, from) {
return; return;
} }
} }
function getIsBailout(submittedState) {
const submittedStateObj = JSON.parse(submittedState);
return !!submittedStateObj?.applicationUser?.bailoutCode;
}