Fix routing when logged out
This commit is contained in:
parent
f8559b477b
commit
92960c4fa7
@ -5,10 +5,8 @@ import LoginView from '../views/LoginView.vue'
|
||||
import userAPIS from '../api/user'
|
||||
|
||||
const authGuard = async () => {
|
||||
console.log('1tady')
|
||||
const data = await userAPIS.getUserStatus()
|
||||
if (!data.data) {
|
||||
console.log('tady')
|
||||
throw router.push('/')
|
||||
}
|
||||
}
|
||||
@ -59,7 +57,9 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (requiresAuth) {
|
||||
const userStatus = await userAPIS.getUserStatus()
|
||||
if (!userStatus.data) {
|
||||
throw router.push('/login')
|
||||
router.replace('/login')
|
||||
next()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user