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

@ -6,6 +6,16 @@ import WebStorageCache from 'web-storage-cache'
type CacheType = 'localStorage' | 'sessionStorage'
export const CACHE_KEY = {
IS_DARK: 'isDark',
USER: 'user',
LANG: 'lang',
THEME: 'theme',
LAYOUT: 'layout',
ROLE_ROUTERS: 'roleRouters',
DICT_CACHE: 'dictCache'
}
export const useCache = (type: CacheType = 'localStorage') => {
const wsCache: WebStorageCache = new WebStorageCache({
storage: type