diff --git a/src/store/index.js b/src/store/index.js index 4d079056e..673bf36ee 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,6 +1,7 @@ import { createStore } from "vuex"; import { endpoints } from "@/constants/endpoints.js"; import { storeMutations } from "@/constants/store-mutations"; +import { sessionStorageKeyConstants } from "@/constants/session-storage.js"; import { getDateForSavedSessionTimeout } from "@/helpers/heritage-integration/session-helper"; import createPersistedState from "vuex-persistedstate"; import globalMethods from "@/global-methods"; @@ -822,8 +823,8 @@ export const getters = { }, coverageIsVerified: (state) => { let order; - if (window.sessionStorage.getItem("submittedState") !== null) { - order = JSON.parse(window.sessionStorage.getItem("submittedState")).order; + if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) { + order = JSON.parse(window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE)).order; } else { order = state.order; } @@ -851,9 +852,9 @@ export const getters = { return getHasRecalibrationPart(state); }, isRecalibrationOnSubmittedState: (state) => { - if (window.sessionStorage.getItem("submittedState") !== null) { + if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) { return getHasRecalibrationPart({ - order: JSON.parse(window.sessionStorage.getItem("submittedState")).order, + order: JSON.parse(window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE)).order, }); } @@ -861,8 +862,8 @@ export const getters = { }, shouldHideRecalibration: (state) => { var order; - if (window.sessionStorage.getItem("submittedState") !== null) { - order = JSON.parse(window.sessionStorage.getItem("submittedState")).order; + if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) { + order = JSON.parse(window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE)).order; } else { order = state.order; } @@ -3258,7 +3259,7 @@ export const actions = { }, createSubmittedState(context) { - if (window.sessionStorage.getItem("submittedState") !== null) { + if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) { return; } @@ -3272,7 +3273,7 @@ export const actions = { const affiliateCookies = context.state.applicationUser.affiliateCookies; // set to local storage - window.sessionStorage.setItem("submittedState", JSON.stringify(submittedState)); + window.sessionStorage.setItem(sessionStorageKeyConstants.SUBMITTED_STATE, JSON.stringify(submittedState)); window.sessionStorage.setItem("createNewSessionForHeritage", true); // clear vuex @@ -3330,12 +3331,12 @@ export const actions = { applicationUser: submittedApplicationUser, }; // set to local storage - window.sessionStorage.setItem("submittedState", JSON.stringify(submittedState)); + window.sessionStorage.setItem(sessionStorageKeyConstants.SUBMITTED_STATE, JSON.stringify(submittedState)); }, resetSubmittedState(context) { // clear from local storage - window.sessionStorage.removeItem("submittedState"); + window.sessionStorage.removeItem(sessionStorageKeyConstants.SUBMITTED_STATE); }, resetExternalParameterState(context) { if (context.getters.isExternalParameter) {