设备管理
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
1.2 KiB

import Keys from "@/api/Keys";
// @ts-ignore
import { useCache } from "@/hooks/useCache";
const { wsCache } = useCache();
export const getToken = () => wsCache.get(Keys.STORAGE_TOKEN);
export const setToken = (token: string) => {
wsCache.set(Keys.STORAGE_TOKEN, token);
};
export const setRefreshToken = (refreshToken: any) => {
wsCache.set(Keys.STORAGE_REFRESH_TOKEN, refreshToken);
};
export const getRefreshToken = () => wsCache.get(Keys.STORAGE_REFRESH_TOKEN);
export const removeToken = () => {
wsCache.delete(Keys.STORAGE_TOKEN);
wsCache.delete(Keys.STORAGE_REFRESH_TOKEN);
};
export const getLocalUserInfo = () => wsCache.get(Keys.STORAGE_USER_INFO);
export const setUserInfo = (userInfo: any) =>
wsCache.set(Keys.STORAGE_USER_INFO, userInfo);
// ========== 权限路由相关 ==========
export const getRoleRouters = () => wsCache.get(Keys.STORAGE_ROLE_ROUTERS);
export const setRoleRouters = (roleRouters: any) =>
wsCache.set(Keys.STORAGE_ROLE_ROUTERS, roleRouters);
// ========== 租户相关 ==========
export const getTenantId = () => wsCache.get(Keys.STORAGE_TENANT_ID);
export const setTenantId = (tenantId: number) =>
wsCache.set(Keys.STORAGE_TENANT_ID, tenantId);