diff --git a/src/utils/auth.ts b/src/utils/auth.ts index 3b2bb30..35e1b64 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -1,44 +1,44 @@ -import { loacl } from './storage'; +import { local } from './storage'; import { EnumStorageKey } from '@/enum'; const DURATION = 6 * 60 * 60; /* 获取当前token */ export function getToken() { - return loacl.get(EnumStorageKey.token); + return local.get(EnumStorageKey.token); } /* 设置token */ export function setToken(data: string) { - loacl.set(EnumStorageKey.token, data, DURATION); + local.set(EnumStorageKey.token, data, DURATION); } /* 移除token */ export function removeToken() { - loacl.remove(EnumStorageKey.token); + local.remove(EnumStorageKey.token); } /* 获取当前refreshToken */ export function getRefreshToken() { - return loacl.get(EnumStorageKey.refreshToken); + return local.get(EnumStorageKey.refreshToken); } /* 设置refreshToken */ export function setRefreshToken(data: string) { - loacl.set(EnumStorageKey.refreshToken, data, DURATION); + local.set(EnumStorageKey.refreshToken, data, DURATION); } /* 移除refreshToken */ export function removeRefreshToken() { - loacl.remove(EnumStorageKey.refreshToken); + local.remove(EnumStorageKey.refreshToken); } /* 获取用户详情 */ export function getUserInfo() { - return loacl.get(EnumStorageKey.userInfo); + return local.get(EnumStorageKey.userInfo); } /* 设置用户详情 */ export function setUserInfo(data: any) { - loacl.set(EnumStorageKey.userInfo, data); + local.set(EnumStorageKey.userInfo, data); } /* 移除用户详情 */ export function removeUserInfo() { - loacl.remove(EnumStorageKey.userInfo); + local.remove(EnumStorageKey.userInfo); } /** 去除用户相关缓存 */ diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 2be6cc1..4c62542 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -34,7 +34,7 @@ function createLocalStorage() { return value; } } - loacl.remove(key); + local.remove(key); return null; } @@ -81,5 +81,5 @@ function createSessionStorage() { } } -export const loacl = createLocalStorage(); +export const local = createLocalStorage(); export const session = createSessionStorage(); diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 53d9782..7dfd7d6 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -78,7 +78,9 @@ :size="24" >