未登录的时候页面跳转问题修复
This commit is contained in:
@@ -7,7 +7,7 @@ const router = createRouter({
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: () => import('../views/HomeView.vue'),
|
||||
meta: { requiresAuth: false }
|
||||
meta: { requiresAuth: true }
|
||||
},
|
||||
{
|
||||
path: '/auth',
|
||||
@@ -62,6 +62,8 @@ router.beforeEach((to, _from, next) => {
|
||||
next('/auth')
|
||||
} else if (to.path === '/auth' && token) {
|
||||
next('/')
|
||||
} else if (to.path === '/' && !token) {
|
||||
next('/auth')
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user