1
0
tangning 4 місяців тому
батько
коміт
ad0b3d9389
2 змінених файлів з 2 додано та 3 видалено
  1. 1 2
      src/store/user.ts
  2. 1 1
      src/util/localUtil.ts

+ 1 - 2
src/store/user.ts

@@ -48,9 +48,8 @@ export const getUserPagging = async (params: PaggingReq<Params>) =>
 export const getUsers = async (deptId?: string) =>
   (await axios.get<UserInfo[]>(getUserListSelect, { params: { deptId } })).data;
 // 当前用户的信息
-
 export const user = ref({
-  token: getLocal("token", {}) || "",
+  token: localStorage.getItem('token') || "",
   info: getLocal("info", {} as UserInfo),
 });
 

+ 1 - 1
src/util/localUtil.ts

@@ -8,7 +8,7 @@ export const getLocal = <T>(key: string, def: T): T => {
       result = JSON.parse(str);
     }
   } catch {
-    result = def;
+    result = def || localStorage.getItem(key);
   }
   return result;
 };