Merge branch 'main' into #3-calendar
# Conflicts: # package-lock.json # src/main.css # src/router/authGuards.ts # src/types/permissionTypes.ts
This commit is contained in:
commit
8074dbf5c4
38 changed files with 2228 additions and 66 deletions
|
@ -69,7 +69,7 @@ export async function isAuthenticatedPromise(): Promise<Payload> {
|
|||
|
||||
var { firstname, lastname, mail, username, permissions, isOwner } = decoded;
|
||||
|
||||
if (Object.keys(permissions).length === 0 && !isOwner) {
|
||||
if (Object.keys(permissions ?? {}).length === 0 && !isOwner) {
|
||||
auth.setFailed();
|
||||
reject("nopermissions");
|
||||
}
|
||||
|
|
|
@ -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,63 @@ 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/club/protocol/Protocol.vue"),
|
||||
beforeEnter: [resetProtocolStores],
|
||||
},
|
||||
{
|
||||
path: ":protocolId",
|
||||
name: "admin-club-protocol-routing",
|
||||
component: () => import("@/views/admin/club/protocol/ProtocolRouting.vue"),
|
||||
beforeEnter: [setProtocolId],
|
||||
props: true,
|
||||
children: [
|
||||
{
|
||||
path: "overview",
|
||||
name: "admin-club-protocol-overview",
|
||||
component: () => import("@/views/admin/club/protocol/ProtocolOverview.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "presence",
|
||||
name: "admin-club-protocol-presence",
|
||||
component: () => import("@/views/admin/club/protocol/ProtocolPresence.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "voting",
|
||||
name: "admin-club-protocol-voting",
|
||||
component: () => import("@/views/admin/club/protocol/ProtocolVoting.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "decisions",
|
||||
name: "admin-club-protocol-decisions",
|
||||
component: () => import("@/views/admin/club/protocol/ProtocolDecisions.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "agenda",
|
||||
name: "admin-club-protocol-agenda",
|
||||
component: () => import("@/views/admin/club/protocol/ProtocolAgenda.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "printout",
|
||||
name: "admin-club-protocol-printout",
|
||||
component: () => import("@/views/admin/club/protocol/ProtocolPrintout.vue"),
|
||||
props: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
33
src/router/protocolGuard.ts
Normal file
33
src/router/protocolGuard.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { useProtocolStore } from "@/stores/admin/protocol";
|
||||
import { useProtocolAgendaStore } from "@/stores/admin/protocolAgenda";
|
||||
import { useProtocolDecisionStore } from "@/stores/admin/protocolDecision";
|
||||
import { useProtocolPresenceStore } from "@/stores/admin/protocolPresence";
|
||||
import { useProtocolVotingStore } from "@/stores/admin/protocolVoting";
|
||||
import { useProtocolPrintoutStore } from "../stores/admin/protocolPrintout";
|
||||
|
||||
export async function setProtocolId(to: any, from: any, next: any) {
|
||||
const protocol = useProtocolStore();
|
||||
protocol.activeProtocol = to.params?.protocolId ?? null;
|
||||
|
||||
useProtocolAgendaStore().$reset();
|
||||
useProtocolDecisionStore().$reset();
|
||||
useProtocolPresenceStore().$reset();
|
||||
useProtocolVotingStore().$reset();
|
||||
useProtocolPrintoutStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetProtocolStores(to: any, from: any, next: any) {
|
||||
const protocol = useProtocolStore();
|
||||
protocol.activeProtocol = null;
|
||||
protocol.activeProtocolObj = null;
|
||||
|
||||
useProtocolAgendaStore().$reset();
|
||||
useProtocolDecisionStore().$reset();
|
||||
useProtocolPresenceStore().$reset();
|
||||
useProtocolVotingStore().$reset();
|
||||
useProtocolPrintoutStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue