瀏覽代碼

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

- 添加调试日志输出用户信息
- 将权限验证从 buttons 字段改为 perms 字段
- 确保单个权限码和多个权限码验证都使用正确的字段
zhangtao 1 天之前
父節點
當前提交
2de432396c
共有 1 個文件被更改,包括 3 次插入2 次删除
  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 {