feat: add 404 page
This commit is contained in:
+10
-5
@@ -64,11 +64,11 @@ const router = createRouter({
|
||||
// name: 'hostedmessage',
|
||||
// component: () => import('../views/tabsTools/hostedMessage/hostedMessage.vue')
|
||||
// },
|
||||
// {
|
||||
// path: '/:catchAll(.*)',
|
||||
// name: '404',
|
||||
// component: () => import('../views/404.vue')
|
||||
// },
|
||||
{
|
||||
path: '/:catchAll(.*)',
|
||||
name: '404',
|
||||
component: () => import('../components/404.vue')
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
@@ -77,6 +77,11 @@ router.beforeEach((to, from, next) => {
|
||||
const token = localStorage.getItem(CONSTANT.STORE_TOKEN_NAME);
|
||||
const isAuthenticated = Boolean(token && token.trim() !== '');
|
||||
|
||||
// 404页面不需要登录验证
|
||||
if (to.name === '404') {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isAuthenticated && to.path !== '/login') {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user