perf: 减少代码重复

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

View File

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