Better handling for starting second order in session
This commit is contained in:
parent
b1937f58f7
commit
31133fbda0
2 changed files with 11 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ import { checkPagePrerequisites } from "@/router/methods/page-prerequisites";
|
||||||
import { checkLogParam } from "@/helpers/debug-log-helper";
|
import { checkLogParam } from "@/helpers/debug-log-helper";
|
||||||
import { debugLog } from "@/helpers/debug-log-helper";
|
import { debugLog } from "@/helpers/debug-log-helper";
|
||||||
import { handleHeritageReturn } from "@/router/methods/helpers/handle-heritage-return";
|
import { handleHeritageReturn } from "@/router/methods/helpers/handle-heritage-return";
|
||||||
|
import { isVirtualRoute } from "@/router/methods/helpers/is-virtual-route";
|
||||||
|
|
||||||
export async function beforeEach(to, from) {
|
export async function beforeEach(to, from) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -45,7 +46,9 @@ 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) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
src/router/methods/helpers/is-virtual-route.js
Normal file
7
src/router/methods/helpers/is-virtual-route.js
Normal 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;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue