This commit is contained in:
='fauz 2025-10-30 15:26:07 +07:00
parent a813dc0c73
commit e09af27909
2 changed files with 3 additions and 2 deletions

View File

@ -59,6 +59,7 @@ router.beforeEach(async(to, from, next) => {
console.log("Token tidak valid / expired.");
}
}
const isLoggedIn = auth.isLoggedIn;
// const isLoggedIn = auth.isLoggedIn;
// console.log(isLoggedIn)
@ -69,7 +70,7 @@ router.beforeEach(async(to, from, next) => {
// return next('/')
// }
if (to.meta.requiresAuth && !auth.isLoggedIn) {
if (to.meta.requiresAuth && !isLoggedIn) {
return next("/login");
}

View File

@ -11,7 +11,7 @@ export const useAuthStore = defineStore('auth', {
user: null
}),
getters: {
isLoggedIn: (state) => !!state.user !== null,
isLoggedIn: (state) => !!state.user,
// isLoggedIn: (state) => !!state.token && !!state.user,
},
actions: {