Merge pull request #3180 from Safelite/feature/CASH-2563
Feature/CASH 2563
This commit is contained in:
commit
de38e3bf7a
1 changed files with 14 additions and 7 deletions
|
|
@ -76,15 +76,17 @@ export async function beforeEach(to, from) {
|
|||
}
|
||||
|
||||
// Block navigation if an order has been submitted.
|
||||
if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) {
|
||||
const exceptionPages = [
|
||||
FUNNEL_START_PAGE.name,
|
||||
routeData.CONFIRMATION.name,
|
||||
routeData.BAILOUT_SUCCESS.name,
|
||||
];
|
||||
const submittedState = window.sessionStorage.getItem(
|
||||
sessionStorageKeyConstants.SUBMITTED_STATE
|
||||
);
|
||||
if (submittedState !== null) {
|
||||
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 (to.name === routeData.BAILOUT.name) {
|
||||
if (isBailout) {
|
||||
router.push({
|
||||
name: routeData.BAILOUT_SUCCESS.name,
|
||||
});
|
||||
|
|
@ -153,3 +155,8 @@ export async function beforeEach(to, from) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function getIsBailout(submittedState) {
|
||||
const submittedStateObj = JSON.parse(submittedState);
|
||||
return !!submittedStateObj?.applicationUser?.bailoutCode;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue