ff-admin/src/stores/account.ts

29 lines
820 B
TypeScript
Raw Normal View History

2024-08-23 14:42:32 +02:00
import { defineStore } from "pinia";
import type { PermissionObject } from "../types/permissionTypes";
2024-08-23 14:42:32 +02:00
export const useAccountStore = defineStore("account", {
state: () => {
return {
firstname: "" as string,
lastname: "" as string,
mail: "" as string,
alias: "" as string,
permissions: {} as PermissionObject,
2024-08-23 14:42:32 +02:00
};
},
actions: {
logoutAccount() {
localStorage.removeItem("accessToken");
localStorage.removeItem("refreshToken");
window.open("/login", "_self");
},
setAccountData(firstname: string, lastname: string, mail: string, alias: string, permissions: PermissionObject) {
2024-08-23 14:42:32 +02:00
this.firstname = firstname;
this.lastname = lastname;
this.mail = mail;
this.alias = alias;
this.permissions = permissions;
2024-08-23 14:42:32 +02:00
},
},
});