From 5a8c2f1cd3f293ebe2ed5bbd03b6f6f191bfd5c2 Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Wed, 1 Jul 2026 14:09:36 -0400 Subject: [PATCH] Refactoring. --- src/router/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index dcfc11af..25400a08 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -150,12 +150,14 @@ const router = createRouter({ }); router.beforeEach(async (to, from) => { + const store = useMainStore(); const fromQueryPage = from.query?.issPage; + if (fromQueryPage === undefined) { showIssLoadingModal(true); } - const callSaveSession = !useMainStore().order?.referralNumber && (to.name === issPageValues.VEHICLE_SELECTION || to.name === issPageValues.POLICY_VEHICLES); + const callSaveSession = !store.order?.referralNumber && (to.name === issPageValues.VEHICLE_SELECTION || to.name === issPageValues.POLICY_VEHICLES); if (callSaveSession) { // Forcing a synchronous savesession call here to create the referral for the first time. // AfterEach does not support synchronous calls that block navigation. Which is why this is in the beforeEach method. @@ -188,7 +190,6 @@ router.beforeEach(async (to, from) => { return false; } - const store = useMainStore(); // Prevent navigating backwards if we enter a bailout that we are not allowed to go back on if (store.isBailout && from.name === issPageValues.BAILOUT_PAGE && to.name !== 'root' && to.name !== issPageValues.CONTACT_CONFIRMATION && !canBailoutNavigateBack()) {