Skip to content

Commit

Permalink
15742 Fixed missing session storage variable and config dependency (#470
Browse files Browse the repository at this point in the history
)

- 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
  • Loading branch information
severinbeauvais authored Mar 23, 2023
1 parent c07397b commit 1b58953
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 4 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ Vue.use(Vuelidate)
Vue.use(Affix)
Vue.use(Vue2Filters) // needed by SbcFeeSummary

const store = getVuexStore()

// main code
async function start () {
// get config from environment
const processEnvBaseUrl: string = process.env.BASE_URL // eg, /business/
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
Expand Down
1 change: 1 addition & 0 deletions src/store/Configuration/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
2 changes: 2 additions & 0 deletions src/utils/navigate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions src/utils/set-base-route-and-business-id.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 1b58953

Please sign in to comment.