浏览代码

修改token key

bill 2 年之前
父节点
当前提交
2e1d09c71f
共有 1 个文件被更改,包括 14 次插入5 次删除
  1. 14 5
      src/store/user.ts

+ 14 - 5
src/store/user.ts

@@ -37,7 +37,10 @@ export type UserInfo = {
   userName: string;
 };
 
-type Params = Pick<UserInfo, "nickName" | "status" | "userName" | "departmentId">;
+type Params = Pick<
+  UserInfo,
+  "nickName" | "status" | "userName" | "departmentId"
+>;
 export const getUserPagging = async (params: PaggingReq<Params>) =>
   (await axios.get<PaggingRes<UserInfo>>(getUserList, { params })).data;
 
@@ -46,7 +49,7 @@ export const getUsers = async (deptId?: number) =>
 
 // 当前用户的信息
 export const user = ref({
-  token: getLocal("token", ""),
+  token: getLocal("fuseToken", ""),
   info: getLocal("info", {} as UserInfo),
 });
 
@@ -70,7 +73,10 @@ export const updatePassword = async (params: UpdataPassowrdParams) => {
   });
 };
 
-type RegisterParams = Pick<UserInfo, "deptId" | "userName" | "nickName" | "password"> & {
+type RegisterParams = Pick<
+  UserInfo,
+  "deptId" | "userName" | "nickName" | "password"
+> & {
   code: string;
 };
 export const register = async (params: RegisterParams) => {
@@ -82,7 +88,10 @@ export const register = async (params: RegisterParams) => {
   });
 };
 
-export const addUser = async (params: Omit<UserInfo, "id">, deptPath: string[]) => {
+export const addUser = async (
+  params: Omit<UserInfo, "id">,
+  deptPath: string[]
+) => {
   await axios.post(userAdd, {
     ...params,
     deptIdList: deptPath.join(","),
@@ -126,7 +135,7 @@ export const transformSWToken = async (scene: QuoteScene) => {
   return res.data.token;
 };
 
-changSaveLocal("token", () => user.value.token);
+changSaveLocal("fuseToken", () => user.value.token);
 changSaveLocal("info", () => user.value.info);
 
 // 设置全局请求hook