This commit is contained in:
2026-04-01 10:12:52 +08:00
parent f9db706769
commit 90b290af1f
13 changed files with 999 additions and 40 deletions
+14 -1
View File
@@ -24,6 +24,18 @@ const staticRoutes = [
component: () => import("@/views/login/index.vue"),
meta: { requiresAuth: false }
},
{
path: "/register",
name: "Register",
component: () => import("@/views/login/register.vue"),
meta: { requiresAuth: false }
},
{
path: "/forget",
name: "ForgetPassword",
component: () => import("@/views/login/forget.vue"),
meta: { requiresAuth: false }
},
{
path: "/home",
name: "Home",
@@ -151,8 +163,9 @@ function findFirstValidRoute(routes) {
router.beforeEach(async (to, from, next) => {
const token = localStorage.getItem("token");
const publicPaths = ["/login", "/register", "/forget"];
if (to.path === "/login") {
if (publicPaths.includes(to.path)) {
if (token) {
if (!dynamicRoutesAdded) {
await loadAndAddDynamicRoutes();