CASH-462 | Add constant for submittedState

This commit is contained in:
Scott Kiener 2025-04-03 14:15:39 -04:00
parent b90c3644d6
commit 43d1353e52
3 changed files with 12 additions and 6 deletions

View file

@ -0,0 +1,3 @@
export const sessionStorageKeyConstants = {
SUBMITTED_STATE: "submittedState"
}

View file

@ -1,6 +1,7 @@
import store from "@/store";
import { storeActions } from "@/constants/store-actions.js";
import { storeMutations } from "@/constants/store-mutations.js";
import { sessionStorageKeyConstants } from "@/constants/session-storage.js";
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
import { vehicleCategories } from "@/constants/vehicle-categories.js";
import { routerParams } from "@/router/router-constants/router-params";
@ -198,17 +199,17 @@ export default {
}
},
getSubmittedOrder() {
return JSON.parse(window.sessionStorage.getItem("submittedState"))?.order;
return JSON.parse(window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE))?.order;
},
hasSubmittedOrder() {
const submittedState = window.sessionStorage.getItem("submittedState");
const submittedState = window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE);
return submittedState !== null && submittedState.order !== null;
},
getSubmittedApplicationUser() {
return JSON.parse(window.sessionStorage.getItem("submittedState"))?.applicationUser;
return JSON.parse(window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE))?.applicationUser;
},
hasSubmittedApplicationUser() {
const submittedState = window.sessionStorage.getItem("submittedState");
const submittedState = window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE);
return submittedState !== null && submittedState.applicationUser !== null;
},
},

View file

@ -2,6 +2,7 @@
import { createWebHistory, createRouter } from "vue-router";
import { storeActions } from "@/constants/store-actions";
import { storeMutations } from "../constants/store-mutations";
import { sessionStorageKeyConstants } from "@/constants/session-storage.js";
import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js";
import { routingTable } from "@/router/router-constants/routing-table.js";
import { globalEvents, globalEventTypes } from "@/constants/events";
@ -39,6 +40,7 @@ import { shouldStripPromoQueryString } from "@/helpers/promotions-helper";
import bailout from "@/layouts/bailout/bailout";
import { nextTick } from "vue";
import { getBoolFromString } from "@/helpers/boolean-helper";
import { sessionStorageKeyConstants } from "../constants/session-storage";
const routes = [
{
@ -93,10 +95,10 @@ const routes = [
log(" --to.query.fmgPage ", to.query?.fmgPage);
// Intercept all navigation if a submitted order exists in storage
if (window.sessionStorage.getItem("submittedState") !== null) {
if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) {
if (to.query.fmgPage !== funnelStartPageName) {
to.query.fmgPage = fmgPageValues.CONFIRMATION;
log(" --has submittedState go to confirmation");
log(` --has ${sessionStorageKeyConstants.SUBMITTED_STATE} go to confirmation`);
}
}
// On entering the funnel "fresh", read cookie information, decide what to do next.