Skip to content

Commit 4bf2df7

Browse files
severinbeauvaisSeverin Beauvais
andauthored
26910 - Use business id from URL first (bcgov#3344)
Co-authored-by: Severin Beauvais <severin.beauvais@gov.bc.ca>
1 parent c2d6de1 commit 4bf2df7

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

auth-web/src/stores/business.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,10 @@ export const useBusinessStore = defineStore('business', () => {
254254
}
255255

256256
async function loadBusiness (businessQueryIdentifier = '') {
257-
// Check session first or use query string if available.
258-
const businessIdentifier = ConfigHelper.getFromSession(SessionStorageKeys.BusinessIdentifierKey) || businessQueryIdentifier
257+
// Check query string first, if provided, otherwise fall back to business id in session storage.
258+
// Note: session storage might contain business id from last time.
259+
const businessIdentifier = businessQueryIdentifier || ConfigHelper.getFromSession(SessionStorageKeys.BusinessIdentifierKey)
260+
259261
// Need to look at LEAR, because it has the up-to-date names.
260262
const learBusiness = await searchBusiness(businessIdentifier)
261263
const response = await BusinessService.getBusiness(businessIdentifier)

auth-web/src/views/auth/BusinessProfileView.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default class BusinessProfileView extends Mixins(AccountChangeMixin, Next
9898
private editing = false
9999
private isLoading = true
100100
private readonly currentBusiness!: Business
101-
private readonly loadBusiness!: (businessId) => Business
101+
private readonly loadBusiness!: (businessId: string) => Promise<Business>
102102
private navigateBack (): void {
103103
if (this.$route.query.redirect) {
104104
if (this.currentOrganization) {
@@ -113,7 +113,8 @@ export default class BusinessProfileView extends Mixins(AccountChangeMixin, Next
113113
114114
async mounted () {
115115
this.isLoading = true
116-
// Include businessid from query string in case session is empty.
116+
// Pass in business id from URL query string.
117+
// Note: action will set session storage.
117118
await this.loadBusiness(this.$attrs.businessid)
118119
// Check if there is already contact info so that we display the appropriate copy
119120
if ((this.currentBusiness?.contacts?.length || 0) > 0) {

0 commit comments

Comments
 (0)