Skip to content

Commit

Permalink
24755 - fix: when and how is account fetched. (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
hfekete authored Dec 6, 2024
1 parent d051da7 commit 4e8fdac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/bcros/header/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ const { createAccount, logout } = useBcrosAuth()
function switchAccount (accountId: number) {
account.switchCurrentAccount(accountId)
// refresh the page so that account based checks are rerun
window.location.reload()
const url = new URL(window.location)
url.searchParams.set('accountid', accountId.toString())
window.location.assign(url.toString())
}
// logged out menu options
Expand Down
3 changes: 2 additions & 1 deletion src/middleware/02.setupAuth.global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default defineNuxtRouteMiddleware(async (to) => {
// set account stuff (normally would happen after kc init in 'setupAuth')
const account = useBcrosAccount()
await account.setUserName()
await account.setAccountInfo()
const accountNumber = to?.params?.accountid || to?.query?.accountid || undefined
await account.setAccountInfo(+accountNumber)
}
})

0 comments on commit 4e8fdac

Please sign in to comment.