diff --git a/src/constants/session-storage.js b/src/constants/session-storage.js new file mode 100644 index 000000000..577fa4c0f --- /dev/null +++ b/src/constants/session-storage.js @@ -0,0 +1,3 @@ +export const sessionStorageKeyConstants = { + SUBMITTED_STATE: "submittedState" +} \ No newline at end of file diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index 1c33640f8..73677726a 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -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; }, }, diff --git a/src/router/index.js b/src/router/index.js index e2263b32d..95aca54d8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -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.