fix: 修复引导获取token存储问题
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import Cookies from 'js-cookie';
|
||||
import { localRemove, localSet } from '@/utils/cache-local-utils';
|
||||
import {
|
||||
CACHE_LOCAL_LOCK_PASSWD,
|
||||
CACHE_LOCAL_MASK,
|
||||
} from '@/constants/cache-keys-constants';
|
||||
import {
|
||||
TOKEN_ACCESS_COOKIE,
|
||||
TOKEN_REFRESH_COOKIE,
|
||||
@@ -17,11 +22,14 @@ export function getAccessToken(): string {
|
||||
export function setAccessToken(token: string, exp: number): void {
|
||||
const expires = new Date(new Date().getTime() + exp * 1000);
|
||||
Cookies.set(TOKEN_ACCESS_COOKIE, token, { expires });
|
||||
localSet(CACHE_LOCAL_MASK, 'none');
|
||||
}
|
||||
|
||||
/**移除访问令牌 */
|
||||
export function delAccessToken(): void {
|
||||
Cookies.remove(TOKEN_ACCESS_COOKIE);
|
||||
localRemove(CACHE_LOCAL_MASK);
|
||||
localRemove(CACHE_LOCAL_LOCK_PASSWD);
|
||||
}
|
||||
|
||||
/**获取刷新令牌 */
|
||||
|
||||
Reference in New Issue
Block a user