Przeglądaj źródła

fix(auth): 修复权限验证逻辑

- 添加调试日志输出用户信息
- 将权限验证从 buttons 字段改为 perms 字段
- 确保单个权限码和多个权限码验证都使用正确的字段
zhangtao 1 dzień temu
rodzic
commit
2de432396c
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3 2
      src/hooks/business/auth.ts

+ 3 - 2
src/hooks/business/auth.ts

@@ -7,12 +7,13 @@ export function useAuth() {
     if (!authStore.isLogin) {
       return false;
     }
+    console.log(authStore.userInfo, 'authStore');
 
     if (typeof codes === 'string') {
-      return authStore.userInfo.buttons.includes(codes);
+      return authStore.userInfo.perms.includes(codes);
     }
 
-    return codes.some(code => authStore.userInfo.buttons.includes(code));
+    return codes.some(code => authStore.userInfo.perms.includes(code));
   }
 
   return {