Merge pull request #2544 from Safelite/feature/CASH-763

Better handling for starting second order in session
This commit is contained in:
chloeherdsafelite 2025-05-21 15:05:59 -04:00 committed by GitHub
commit 2ba26ddca4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View file

@ -13,6 +13,7 @@ import { checkPagePrerequisites } from "@/router/methods/page-prerequisites";
import { checkLogParam } from "@/helpers/debug-log-helper";
import { debugLog } from "@/helpers/debug-log-helper";
import { handleHeritageReturn } from "@/router/methods/helpers/handle-heritage-return";
import { isVirtualRoute } from "@/router/methods/helpers/is-virtual-route";
export async function beforeEach(to, from) {
try {
@ -45,7 +46,9 @@ export async function beforeEach(to, from) {
// Block navigation if an order has been submitted.
if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) {
if (to.name !== FUNNEL_START_PAGE.name && to.name !== routeData.CONFIRMATION.name) {
const exceptionPages = [FUNNEL_START_PAGE.name, routeData.CONFIRMATION.name];
if (!exceptionPages.some((name) => to.name === name) && !isVirtualRoute(to.name)) {
return false;
}
}

View file

@ -0,0 +1,7 @@
import { routeData } from "@/router/constants/routes";
export function isVirtualRoute(routeName) {
const matchedRoute = Object.values(routeData).find((route) => route.name === routeName);
return matchedRoute?.virtual ?? false;
}