2
0

fix: 静态路由角色拦截限制

This commit is contained in:
TsMask
2024-12-02 16:20:03 +08:00
parent 5e54aaf24d
commit 3f01adb2ad
7 changed files with 78 additions and 118 deletions

View File

@@ -34,8 +34,8 @@ export function createRouteGuard(router: Router) {
const needLogin = !to.meta.constant;
const routeRoles = to.meta.roles || [];
// const hasRole = authStore.userInfo.roles?.some(role => routeRoles.includes(role));
const hasAuth = authStore.isStaticSuper || !routeRoles.length;
const hasRole = authStore.userInfo.roles?.some(role => routeRoles.includes(role));
const hasAuth = !routeRoles.length || hasRole
const routeSwitches: CommonType.StrategicPattern[] = [
// if it is login route when logged in, then switch to the root page