diff --git a/app/pages/dashboard.vue b/app/pages/dashboard/[[id]].vue similarity index 91% rename from app/pages/dashboard.vue rename to app/pages/dashboard/[[id]].vue index d7d3e5b..72ef607 100644 --- a/app/pages/dashboard.vue +++ b/app/pages/dashboard/[[id]].vue @@ -7,6 +7,8 @@ const { $authApi } = useNuxtApp() const { clearLoginRedirectUrl, setLogoutRedirectUrl, kcUser } = useKeycloak() const rtc = useRuntimeConfig().public +const route = useRoute() + useHead({ title: t('page.dashboard.title') }) @@ -18,12 +20,24 @@ definePageMeta({ const isSbcStaff = ref(false) const helpHref = 'https://www2.gov.bc.ca/gov/content/employment-business/business/managing-a-business/' + 'permits-licences/news-updates/modernization-updates/modernization-resources' +// Sync URL <-> accountStore.currentAccount.id +const routeAccountId = Number(route.params.id) +if (routeAccountId > 0 && Number.isFinite(routeAccountId) && routeAccountId !== accountStore.currentAccount.id) { + accountStore.switchCurrentAccount(routeAccountId) +} + +watch(() => accountStore.currentAccount.id, (newId) => { + if (newId) { + window.history.replaceState({}, '', localePath(`/dashboard/${newId}`)) + } +}, { immediate: true }) + const { data: userProducts, status, error } = await useLazyAsyncData( 'user-products', () => productInfo.getActiveUserProducts(), { watch: [() => accountStore.currentAccount.id], - default: () => ([]) + default: () => [] } ) diff --git a/package.json b/package.json index 2946980..70c41e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bc-registry", - "version": "3.0.18", + "version": "3.0.19", "private": true, "type": "module", "scripts": {