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 }; });