From 1b58953c6fb1761d0e7a4a8e439bd857faa6867e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Beauvais?= Date: Thu, 23 Mar 2023 13:12:47 -0700 Subject: [PATCH] 15742 Fixed missing session storage variable and config dependency (#470) - app version = 5.11.5a - updated browsers list - load configuration before checking business id - set missing session storage variable - check for empty URL before navigate --- package-lock.json | 16 ++++++++-------- package.json | 2 +- src/main.ts | 7 ++++--- src/store/Configuration/mutations.ts | 1 + src/utils/navigate.ts | 2 ++ src/utils/set-base-route-and-business-id.ts | 2 -- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 23f7cd15c..bde68ead0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-filings-ui", - "version": "5.11.5", + "version": "5.11.5a", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "business-filings-ui", - "version": "5.11.5", + "version": "5.11.5a", "dependencies": { "@babel/compat-data": "^7.19.1", "@bcrs-shared-components/breadcrumb": "2.1.11", @@ -6569,9 +6569,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001410", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001410.tgz", - "integrity": "sha512-QoblBnuE+rG0lc3Ur9ltP5q47lbguipa/ncNMyyGuqPk44FxbScWAeEO+k5fSQ8WekdAK4mWqNs1rADDAiN5xQ==", + "version": "1.0.30001469", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001469.tgz", + "integrity": "sha512-Rcp7221ScNqQPP3W+lVOYDyjdR6dC+neEQCttoNr5bAyz54AboB4iwpnWgyi8P4YUsPybVzT4LgWiBbI3drL4g==", "dev": true, "funding": [ { @@ -29140,9 +29140,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001410", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001410.tgz", - "integrity": "sha512-QoblBnuE+rG0lc3Ur9ltP5q47lbguipa/ncNMyyGuqPk44FxbScWAeEO+k5fSQ8WekdAK4mWqNs1rADDAiN5xQ==", + "version": "1.0.30001469", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001469.tgz", + "integrity": "sha512-Rcp7221ScNqQPP3W+lVOYDyjdR6dC+neEQCttoNr5bAyz54AboB4iwpnWgyi8P4YUsPybVzT4LgWiBbI3drL4g==", "dev": true }, "capture-exit": { diff --git a/package.json b/package.json index 6ffd5de19..424193354 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-filings-ui", - "version": "5.11.5", + "version": "5.11.5a", "private": true, "appName": "Filings UI", "sbcName": "SBC Common Components", diff --git a/src/main.ts b/src/main.ts index e3493ff14..459782fae 100644 --- a/src/main.ts +++ b/src/main.ts @@ -28,6 +28,8 @@ Vue.use(Vuelidate) Vue.use(Affix) Vue.use(Vue2Filters) // needed by SbcFeeSummary +const store = getVuexStore() + // main code async function start () { // get config from environment @@ -35,11 +37,10 @@ async function start () { const windowLocationPathname = window.location.pathname // eg, /business/CP1234567/... const windowLocationOrigin = window.location.origin // eg, http://localhost:8080 const applicationUrl = windowLocationOrigin + processEnvBaseUrl - setBaseRouteAndBusinessId(windowLocationPathname, processEnvBaseUrl, windowLocationOrigin) // may throw an error - // fetch the store first as it has no dependencies - const store = getVuexStore() + // first load the configuration, then set base route and check business id await store.dispatch('loadConfiguration', applicationUrl) + setBaseRouteAndBusinessId(windowLocationPathname, processEnvBaseUrl, windowLocationOrigin) // may throw an error if (window['sentryEnable'] === 'true') { // initialize Sentry diff --git a/src/store/Configuration/mutations.ts b/src/store/Configuration/mutations.ts index 34eb94929..c64160fb4 100644 --- a/src/store/Configuration/mutations.ts +++ b/src/store/Configuration/mutations.ts @@ -21,6 +21,7 @@ export default { setSessionVariables (_state: ConfigurationStateIF, responseData: any) { // The following four session variables are used by SBC Header (a common component): sessionStorage.setItem('AUTH_WEB_URL', responseData['AUTH_WEB_URL']) + sessionStorage.setItem('BUSINESSES_URL', responseData['BUSINESSES_URL']) sessionStorage.setItem('REGISTRY_HOME_URL', responseData['REGISTRY_HOME_URL']) sessionStorage.setItem('AUTH_API_URL', responseData['AUTH_API_URL'] + responseData['AUTH_API_VERSION'] + '/') sessionStorage.setItem('STATUS_API_URL', responseData['STATUS_API_URL'] + responseData['STATUS_API_VERSION']) diff --git a/src/utils/navigate.ts b/src/utils/navigate.ts index 75dd0fbff..89968239a 100644 --- a/src/utils/navigate.ts +++ b/src/utils/navigate.ts @@ -4,6 +4,8 @@ */ export function navigate (url: string): boolean { try { + if (!url) throw new Error('empty URL') + // get account id and set in params const accountId = JSON.parse(sessionStorage.getItem('CURRENT_ACCOUNT'))?.id if (accountId) { diff --git a/src/utils/set-base-route-and-business-id.ts b/src/utils/set-base-route-and-business-id.ts index 4eae157e4..8fca95578 100644 --- a/src/utils/set-base-route-and-business-id.ts +++ b/src/utils/set-base-route-and-business-id.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-console */ - /** * stores BUSINESS_ID, TEMP_REG_NUMBER, BASE_URL, VUE_ROUTER_BASE from initial route. * FUTURE - consider refactoring this and passing ids to routes.js and getting rid