From ca22cdd5550cfa0defb0f430c538698182cdaec1 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 30 十二月 2024 16:42:49 +0800
Subject: [PATCH] Merge branch 'master' of http://dlindusit.com:53929/r/iailab-plat-ui-vue3

---
 src/utils/permission.ts |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/utils/permission.ts b/src/utils/permission.ts
index a63ee62..43d7f95 100644
--- a/src/utils/permission.ts
+++ b/src/utils/permission.ts
@@ -12,7 +12,8 @@
     const { wsCache } = useCache()
     const permissionDatas = value
     const all_permission = '*:*:*'
-    const permissions = wsCache.get(CACHE_KEY.USER).permissions
+    const userInfo = wsCache.get(CACHE_KEY.USER)
+    const permissions = userInfo?.permissions || []
     const hasPermission = permissions.some((permission) => {
       return all_permission === permission || permissionDatas.includes(permission)
     })
@@ -33,7 +34,8 @@
     const { wsCache } = useCache()
     const permissionRoles = value
     const super_admin = 'admin'
-    const roles = wsCache.get(CACHE_KEY.USER).roles
+    const userInfo = wsCache.get(CACHE_KEY.USER)
+    const roles = userInfo?.roles || []
     const hasRole = roles.some((role) => {
       return super_admin === role || permissionRoles.includes(role)
     })

--
Gitblit v1.9.3