permission system and no access redirect
This commit is contained in:
parent
214f0ddf21
commit
cb80771f7a
8 changed files with 107 additions and 18 deletions
|
@ -1,4 +1,5 @@
|
|||
import { defineStore } from "pinia";
|
||||
import type { PermissionObject } from "../types/permissionTypes";
|
||||
|
||||
export const useAccountStore = defineStore("account", {
|
||||
state: () => {
|
||||
|
@ -7,6 +8,7 @@ export const useAccountStore = defineStore("account", {
|
|||
lastname: "" as string,
|
||||
mail: "" as string,
|
||||
alias: "" as string,
|
||||
permissions: {} as PermissionObject,
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
|
@ -15,11 +17,12 @@ export const useAccountStore = defineStore("account", {
|
|||
localStorage.removeItem("refreshToken");
|
||||
window.open("/login", "_self");
|
||||
},
|
||||
setAccountData(firstname: string, lastname: string, mail: string, alias: string) {
|
||||
setAccountData(firstname: string, lastname: string, mail: string, alias: string, permissions: PermissionObject) {
|
||||
this.firstname = firstname;
|
||||
this.lastname = lastname;
|
||||
this.mail = mail;
|
||||
this.alias = alias;
|
||||
this.permissions = permissions;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { shallowRef, defineAsyncComponent } from "vue";
|
||||
import { useAccountStore } from "../account";
|
||||
|
||||
export interface navigationModel {
|
||||
club: navigationSplitModel;
|
||||
|
@ -30,6 +31,7 @@ export interface navigationLinkModel {
|
|||
|
||||
export const useNavigationStore = defineStore("navigation", {
|
||||
state: () => {
|
||||
const accountStore = useAccountStore();
|
||||
return {
|
||||
activeNavigation: "club" as topLevelNavigationType,
|
||||
activeLink: null as null | navigationLinkModel,
|
||||
|
|
|
@ -10,5 +10,8 @@ export const useAuthStore = defineStore("auth", {
|
|||
setSuccess() {
|
||||
this.authCheck = true;
|
||||
},
|
||||
setFailed() {
|
||||
this.authCheck = false;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue