perf: 减少代码重复

This commit is contained in:
zhou-sheng
2024-07-02 11:29:58 +08:00
parent 775d7a2d32
commit a5f37be49a

View File

@@ -188,16 +188,12 @@ router.beforeEach((to: ToRouteType, _from, next) => {
toCorrectRoute(); toCorrectRoute();
} }
} else { } else {
if (to.path !== "/login") { if (to.path === "/login" || whiteList.includes(to.path)) {
if (whiteList.indexOf(to.path) !== -1) {
next(); next();
} else { } else {
removeToken(); removeToken();
next({ path: "/login" }); next({ path: "/login" });
} }
} else {
next();
}
} }
}); });