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

@ -45,7 +45,7 @@ export const getUsername = () => {
}
export const setUsername = (username: string) => {
wsCache.set(UsernameKey, username)
wsCache.set(UsernameKey, username, { exp: 30 * 24 * 60 * 60 })
}
export const removeUsername = () => {
@ -58,7 +58,7 @@ export const getPassword = () => {
}
export const setPassword = (password: string) => {
wsCache.set(PasswordKey, encrypt(password))
wsCache.set(PasswordKey, encrypt(password), { exp: 30 * 24 * 60 * 60 })
}
export const removePassword = () => {
@ -66,11 +66,11 @@ export const removePassword = () => {
}
export const getRememberMe = () => {
return wsCache.get(RememberMeKey) === 'true'
return wsCache.get(RememberMeKey) === true
}
export const setRememberMe = (rememberMe: string) => {
wsCache.set(RememberMeKey, rememberMe)
export const setRememberMe = (rememberMe: boolean) => {
wsCache.set(RememberMeKey, rememberMe, { exp: 30 * 24 * 60 * 60 })
}
export const removeRememberMe = () => {
@ -87,7 +87,7 @@ export const getTenantName = () => {
}
export const setTenantName = (username: string) => {
wsCache.set(TenantNameKey, username)
wsCache.set(TenantNameKey, username, { exp: 30 * 24 * 60 * 60 })
}
export const removeTenantName = () => {

View File

@ -18,7 +18,7 @@ export const getParentLayout = () => {
}
// 按照路由中meta下的rank等级升序来排序路由
export function ascending(arr: any[]) {
export const ascending = (arr: any[]) => {
arr.forEach((v) => {
if (v?.meta?.rank === null) v.meta.rank = undefined
if (v?.meta?.rank === 0) {
@ -109,7 +109,7 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord
data.children = generateRoute(route.children)
}
}
res.push(data)
res.push(data as AppRouteRecordRaw)
}
return res
}
@ -203,7 +203,7 @@ const addToChildren = (
}
}
}
function toCamelCase(str: string, upperCaseFirst: boolean) {
const toCamelCase = (str: string, upperCaseFirst: boolean) => {
str = (str || '').toLowerCase().replace(/-(.)/g, function (group1: string) {
return group1.toUpperCase()
})