feat: add cache key

This commit is contained in:
xingyu4j
2022-12-06 16:12:54 +08:00
parent c8c6e349ae
commit 3e60ff2970
18 changed files with 100 additions and 81 deletions

View File

@ -1,5 +1,5 @@
import type { App } from 'vue'
import { useCache } from '@/hooks/web/useCache'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n() // 国际化
@ -8,7 +8,7 @@ export function hasPermi(app: App<Element>) {
const { wsCache } = useCache()
const { value } = binding
const all_permission = '*:*:*'
const permissions = wsCache.get('user').permissions
const permissions = wsCache.get(CACHE_KEY.USER).permissions
if (value && value instanceof Array && value.length > 0) {
const permissionFlag = value

View File

@ -1,5 +1,5 @@
import type { App } from 'vue'
import { useCache } from '@/hooks/web/useCache'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n() // 国际化
@ -8,7 +8,7 @@ export function hasRole(app: App<Element>) {
const { wsCache } = useCache()
const { value } = binding
const super_admin = 'admin'
const roles = wsCache.get('user').roles
const roles = wsCache.get(CACHE_KEY.USER).roles
if (value && value instanceof Array && value.length > 0) {
const roleFlag = value