create webapp stencil with side bar, routes and fake login

This commit is contained in:
2025-02-16 21:25:45 -07:00
parent de771d83b1
commit 6a8a4a13ba
13 changed files with 533 additions and 9 deletions

View File

@ -0,0 +1,21 @@
import { ref } from 'vue';
import { defineStore } from 'pinia';
export const useAuthenticationStore = defineStore('authentication', () => {
// TODO: this should be replaced with a request to the server to check if the user is authenticated
const isAuthenticated = ref(localStorage.getItem('isAuthenticated') === 'true');
function login() {
// TODO: make a request to the server to authenticate the user
isAuthenticated.value = true;
localStorage.setItem('isAuthenticated', 'true');
}
function logout() {
// TODO: make a request to the server to log out the user
isAuthenticated.value = false;
localStorage.setItem('isAuthenticated', 'false');
}
return { isAuthenticated, login, logout };
});