Files
WAI_Project_UNIX/router/index.ts
2025-07-21 16:47:04 +08:00

23 lines
389 B
TypeScript

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();
}
}
});