增加空判断保护

This commit is contained in:
shizhong
2024-03-21 15:09:03 +08:00
parent 8f368774ef
commit 75d0bdcc49
3 changed files with 25 additions and 4 deletions

View File

@ -8,7 +8,7 @@ export function hasRole(app: App<Element>) {
const { wsCache } = useCache()
const { value } = binding
const super_admin = 'admin'
const roles = wsCache.get(CACHE_KEY.USER).roles
const roles = wsCache.get(CACHE_KEY.USER)?.roles ? wsCache.get(CACHE_KEY.USER)?.roles : []
if (value && value instanceof Array && value.length > 0) {
const roleFlag = value