版本发布
This commit is contained in:
22
router/index.ts
Normal file
22
router/index.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { router, useStore } from "@/cool";
|
||||
|
||||
const ignoreToken = [
|
||||
"/pages/index/home",
|
||||
"/pages/index/my",
|
||||
"/pages/user/login",
|
||||
"/pages/user/doc"
|
||||
];
|
||||
|
||||
router.beforeEach((to, next) => {
|
||||
const { user } = useStore();
|
||||
|
||||
if (ignoreToken.includes(to.path) || to.path.startsWith("/pages/demo")) {
|
||||
next();
|
||||
} else {
|
||||
if (!user.isNull()) {
|
||||
next();
|
||||
} else {
|
||||
router.login();
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user