Answer the question
In order to leave comments, you need to log in
Router does not see isAuth state changes, how to track?
Router code
router.beforeEach((to, from, next) => {
const requireAuth = to.meta.auth
if (requireAuth && store.getters['auth/isAuthenticated']) {
next()
} else if (requireAuth && !store.getters['auth/isAuthenticated']) {
next({name: 'login'})
} else if (!requireAuth && store.getters['auth/isAuthenticated']) {
next({name: 'admin'})
} else {
next()
}
})
state() {
return {
isAuth: false,
user: null,
emailFormFactor: ''
}
},
getters: {
isAuthenticated(state) {
return state.isAuth
},
getEmailFormFactor(state) {
return state.emailFormFactor
},
getUser(state) {
return state.user
}
}
onBeforeMount(
() => {
if (localStorage.getItem('auth-token')) {
store.dispatch('auth/checkAuth')
}
}
)
Answer the question
In order to leave comments, you need to log in
does not exist
in this extension, depending on sites, it's simple, the
proxy is just part of the request header,
and once every half an hour, all tabs will have to be changed with unpredictable consequences
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question