| | |
| | | import { useCache, CACHE_KEY } from '@/hooks/web/useCache' |
| | | import { TokenType } from '@/api/login/types' |
| | | import {TokenType} from '@/api/login/types' |
| | | import { decrypt, encrypt } from '@/utils/jsencrypt' |
| | | |
| | | const { wsCache } = useCache() |
| | | |
| | | const AccessTokenKey = 'ACCESS_TOKEN' |
| | | const RefreshTokenKey = 'REFRESH_TOKEN' |
| | | const TenantId = 'tenantId' |
| | | |
| | | // 获取token |
| | | export const getAccessToken = () => { |
| | |
| | | export const setToken = (token: TokenType) => { |
| | | wsCache.set(RefreshTokenKey, token.refreshToken) |
| | | wsCache.set(AccessTokenKey, token.accessToken) |
| | | wsCache.set(TenantId, import.meta.env.VITE_TENANT_ID) |
| | | } |
| | | |
| | | // 删除token |