auth
This commit is contained in:
parent
a813dc0c73
commit
e09af27909
@ -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");
|
||||
}
|
||||
|
||||
|
||||
@ -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: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user