protocol base views
This commit is contained in:
parent
f453bdc7d3
commit
c1e9784b4a
14 changed files with 708 additions and 24 deletions
|
@ -7,6 +7,7 @@ import { isSetup } from "./setupGuard";
|
|||
import { abilityAndNavUpdate } from "./adminGuard";
|
||||
import type { PermissionType, PermissionSection, PermissionModule } from "@/types/permissionTypes";
|
||||
import { resetMemberStores, setMemberId } from "./memberGuard";
|
||||
import { resetProtocolStores, setProtocolId } from "./protocolGuard";
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
|
@ -148,10 +149,41 @@ const router = createRouter({
|
|||
},
|
||||
{
|
||||
path: "protocol",
|
||||
name: "admin-club-protocol",
|
||||
component: () => import("@/views/admin/members/Overview.vue"),
|
||||
meta: { type: "read", section: "club", module: "protocoll" },
|
||||
name: "admin-club-protocol-route",
|
||||
component: () => import("@/views/RouterView.vue"),
|
||||
meta: { type: "read", section: "club", module: "protocol" },
|
||||
beforeEnter: [abilityAndNavUpdate],
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
name: "admin-club-protocol",
|
||||
component: () => import("@/views/admin/protocol/Protocol.vue"),
|
||||
beforeEnter: [resetProtocolStores],
|
||||
},
|
||||
{
|
||||
path: ":protocolId",
|
||||
name: "admin-club-protocol-routing",
|
||||
component: () => import("@/views/admin/protocol/ProtocolRouting.vue"),
|
||||
beforeEnter: [setProtocolId],
|
||||
props: true,
|
||||
children: [
|
||||
{
|
||||
path: "overview",
|
||||
name: "admin-club-protocol-overview",
|
||||
component: () => import("@/views/admin/protocol/ProtocolOverview.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "edit",
|
||||
name: "admin-club-protocol-edit",
|
||||
component: () => import("@/views/admin/protocol/ProtocolEdit.vue"),
|
||||
meta: { type: "update", section: "club", module: "member" },
|
||||
beforeEnter: [abilityAndNavUpdate],
|
||||
props: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
16
src/router/protocolGuard.ts
Normal file
16
src/router/protocolGuard.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { useProtocolStore } from "@/stores/admin/protocol";
|
||||
|
||||
export async function setProtocolId(to: any, from: any, next: any) {
|
||||
const protocol = useProtocolStore();
|
||||
protocol.activeProtocol = to.params?.protocolId ?? null;
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetProtocolStores(to: any, from: any, next: any) {
|
||||
const protocol = useProtocolStore();
|
||||
protocol.activeProtocol = null;
|
||||
protocol.activeProtocolObj = null;
|
||||
|
||||
next();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue