diff --git a/src/router/index.ts b/src/router/index.ts index dc89b8e..cf17ac2 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHistory, createWebHashHistory } from "vue-router"; +import { createRouter, createWebHistory } from "vue-router"; import Login from "@/views/Login.vue"; import { isAuthenticated } from "./authGuards"; @@ -6,7 +6,7 @@ import { loadAccountData } from "./accountGuard"; import { isSetup } from "./setupGuard"; import { abilityAndNavUpdate } from "./adminGuard"; import type { PermissionType, PermissionSection, PermissionModule } from "@/types/permissionTypes"; -import { setMemberId } from "./memberGuard"; +import { resetMemberStores, setMemberId } from "./memberGuard"; const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -75,6 +75,7 @@ const router = createRouter({ path: "", name: "admin-club-member", component: () => import("@/views/admin/members/Member.vue"), + beforeEnter: [resetMemberStores], }, { path: ":id/edit", diff --git a/src/router/memberGuard.ts b/src/router/memberGuard.ts index 0b78da2..93406e2 100644 --- a/src/router/memberGuard.ts +++ b/src/router/memberGuard.ts @@ -17,3 +17,17 @@ export async function setMemberId(to: any, from: any, next: any) { next(); } + +export async function resetMemberStores(to: any, from: any, next: any) { + const member = useMemberStore(); + member.activeMember = null; + member.activeMemberObj = null; + + useMembershipStore().$reset(); + useCommunicationStore().$reset(); + useMemberAwardStore().$reset(); + useMemberExecutivePositionStore().$reset(); + useMemberQualificationStore().$reset(); + + next(); +} diff --git a/src/views/admin/members/MemberRouting.vue b/src/views/admin/members/MemberRouting.vue index e7cc557..dcb8528 100644 --- a/src/views/admin/members/MemberRouting.vue +++ b/src/views/admin/members/MemberRouting.vue @@ -1,5 +1,8 @@