chore(frontend): Documentation & refactoring
Adding documentation to functions & some further refactoring.
This commit is contained in:
parent
26d5c09bb4
commit
d64b4505c8
4 changed files with 73 additions and 30 deletions
|
@ -1,12 +1,25 @@
|
|||
import type {Role} from "@/services/auth/auth-types.ts";
|
||||
|
||||
export default {
|
||||
/**
|
||||
* Get the role the user is currently logged in as from the local persistent storage.
|
||||
*/
|
||||
getActiveRole(): Role | undefined {
|
||||
return localStorage.getItem("activeRole") as Role | undefined;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the role the user is currently logged in as from the local persistent storage.
|
||||
* This should happen when the user logs in with another account.
|
||||
*/
|
||||
setActiveRole(role: Role) {
|
||||
localStorage.setItem("activeRole", role);
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove the saved current role from the local persistent storage.
|
||||
* This should happen when the user is logged out.
|
||||
*/
|
||||
deleteActiveRole() {
|
||||
localStorage.removeItem("activeRole");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue