update
This commit is contained in:
+10
-9
@@ -48,17 +48,18 @@ const router: Router = createRouter({
|
||||
history: createWebHistory('/'),
|
||||
routes: [...routes],
|
||||
});
|
||||
const xian = ['/home', '/secondScreen', '/transfer'];
|
||||
const yinchuan = ['/yinChuanHome', '/yinChuanTest', '/transfer'];
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.path !== '/login' && to.path !== '/home') {
|
||||
setCurrentPath(to.path);
|
||||
}
|
||||
const flag = getAuthCache('flag3');
|
||||
const token = getAuthCache(TOKEN_KEY);
|
||||
if (!flag || !token) {
|
||||
return next({ path: '/login' });
|
||||
if (to.path == '/login') {
|
||||
next();
|
||||
} else {
|
||||
const flag = getAuthCache('flag3');
|
||||
const token = getAuthCache(TOKEN_KEY);
|
||||
if (!flag || !token) {
|
||||
return next({ path: '/login' });
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user