From 13897c7009af80fe55771a044973198c1df84557 Mon Sep 17 00:00:00 2001
From: Karim El Jazzar <122301442+JazzarKarim@users.noreply.github.com>
Date: Wed, 8 Jan 2025 14:52:53 -0500
Subject: [PATCH] fix: fixed staff account id redirection (#45)
* fix: fixed staff account id redirection
* removed commented code
* changed page titles based on if staff or not
* fixed unit tests
* fixed lint + typing issue
* added comments
* moved to /account/[orgId] + added middleware
* fixed comment
* fixed isStaffOrSbcStaff check
* fixed unit tests by using the computed property
* DRY
* removed unnecessary div
* handle intermittent page 404 not found
---
.../app/components/DashboardContent.vue | 6 ++++
.../app/layouts/dashboard.vue | 11 ++++---
.../app/locales/en-CA.ts | 5 ++-
.../app/locales/fr-CA.ts | 5 ++-
.../app/middleware/01.account-link.global.ts | 12 +++++++
.../{01.auth.global.ts => 02.auth.global.ts} | 0
.../app/pages/[...slug].vue | 10 ++++++
.../app/pages/account/[orgId].vue | 5 +++
.../affiliationInvitation/acceptToken.vue | 5 +--
.../app/pages/incorporateNow.vue | 3 +-
.../app/pages/index.vue | 5 +--
.../app/stores/affiliations.ts | 13 +++++++-
business-registry-dashboard/package.json | 2 +-
.../tests/unit/pages/index.test.ts | 5 ++-
.../tests/unit/stores/affiliations.test.ts | 33 +++++++++++++++++--
15 files changed, 97 insertions(+), 23 deletions(-)
create mode 100644 business-registry-dashboard/app/components/DashboardContent.vue
create mode 100644 business-registry-dashboard/app/middleware/01.account-link.global.ts
rename business-registry-dashboard/app/middleware/{01.auth.global.ts => 02.auth.global.ts} (100%)
create mode 100644 business-registry-dashboard/app/pages/[...slug].vue
create mode 100644 business-registry-dashboard/app/pages/account/[orgId].vue
diff --git a/business-registry-dashboard/app/components/DashboardContent.vue b/business-registry-dashboard/app/components/DashboardContent.vue
new file mode 100644
index 0000000..6b8c6e8
--- /dev/null
+++ b/business-registry-dashboard/app/components/DashboardContent.vue
@@ -0,0 +1,6 @@
+
+
diff --git a/business-registry-dashboard/app/locales/en-CA.ts b/business-registry-dashboard/app/locales/en-CA.ts
index 437d4bc..39fdf0f 100644
--- a/business-registry-dashboard/app/locales/en-CA.ts
+++ b/business-registry-dashboard/app/locales/en-CA.ts
@@ -496,7 +496,8 @@ export default {
resendEmail: 'Resend Email',
removeFromList: 'Remove From List',
removeBusiness: 'Remove Business',
- bcRegDashboard: 'BC Registries Dashboard'
+ bcRegDashboard: 'BC Registries Dashboard',
+ bcRegStaffDashboard: 'Staff Dashboard'
},
links: {
busCorpAct: {
@@ -610,7 +611,9 @@ export default {
},
home: {
title: 'My Business Registry',
+ titleStaff: 'My Staff Business Registry',
h1: 'My Business Registry',
+ h1Staff: 'My Staff Business Registry',
intro: 'Start B.C. based businesses and keep business records up to date.',
busOrNRSearch: {
label: 'Retrieve an existing business or active Name Request to manage:',
diff --git a/business-registry-dashboard/app/locales/fr-CA.ts b/business-registry-dashboard/app/locales/fr-CA.ts
index fe5a9c4..a1544b9 100644
--- a/business-registry-dashboard/app/locales/fr-CA.ts
+++ b/business-registry-dashboard/app/locales/fr-CA.ts
@@ -486,7 +486,8 @@ export default {
resendEmail: 'Renvoyer le Courriel',
removeFromList: 'Supprimer de la Liste',
removeBusiness: "Supprimer l'Entreprise",
- bcRegDashboard: 'Tableau de Bord des Registres de la CB'
+ bcRegDashboard: 'Tableau de Bord des Registres de la CB',
+ bcRegStaffDashboard: 'Tableau de Bord du Personnel'
},
links: {
busCorpAct: {
@@ -600,7 +601,9 @@ export default {
},
home: {
title: "Mon Registre d'Entreprise",
+ titleStaff: 'Registre des Entreprises de mon Personnel',
h1: "Mon Registre d'Entreprise",
+ h1Staff: 'Registre des Entreprises de mon Personnel',
intro: 'Commencer la CB entreprises basées et tenir à jour les dossiers commerciaux.',
busOrNRSearch: {
label: 'Rechercher une Entreprise Existante ou une Demande de Nom Active à Gérer:',
diff --git a/business-registry-dashboard/app/middleware/01.account-link.global.ts b/business-registry-dashboard/app/middleware/01.account-link.global.ts
new file mode 100644
index 0000000..8951e2a
--- /dev/null
+++ b/business-registry-dashboard/app/middleware/01.account-link.global.ts
@@ -0,0 +1,12 @@
+export default defineNuxtRouteMiddleware((to) => {
+ // Check if the route is an account link without locale prefix
+ if (to.path.startsWith('/account')) {
+ // Construct the full URL with the en-CA locale prefix
+ const newUrl = `/en-CA${to.path}`
+ // Force a full page reload with the new URL to ensure proper locale handling
+ window.location.href = newUrl
+
+ // Prevent Nuxt from handling the navigation since we're doing a full page reload
+ return abortNavigation()
+ }
+})
diff --git a/business-registry-dashboard/app/middleware/01.auth.global.ts b/business-registry-dashboard/app/middleware/02.auth.global.ts
similarity index 100%
rename from business-registry-dashboard/app/middleware/01.auth.global.ts
rename to business-registry-dashboard/app/middleware/02.auth.global.ts
diff --git a/business-registry-dashboard/app/pages/[...slug].vue b/business-registry-dashboard/app/pages/[...slug].vue
new file mode 100644
index 0000000..604f5d2
--- /dev/null
+++ b/business-registry-dashboard/app/pages/[...slug].vue
@@ -0,0 +1,10 @@
+
+
+
+