소스 검색

feat: save

gemercheung 1 년 전
부모
커밋
44bcf852a0
2개의 변경된 파일9개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      src/request/index.ts
  2. 2 0
      src/request/organization.ts

+ 7 - 4
src/request/index.ts

@@ -23,7 +23,7 @@ import {
 
 const error = throttle((msg: string) => ElMessage.error(msg), 2000);
 
-type Other = { params?: Param; paths?: Param; useResult?: boolean };
+type Other = { params?: Param; paths?: Param; useResult?: boolean, noToken?: boolean };
 export const sendFetch = <T>(
   url: string,
   init: RequestInit,
@@ -41,6 +41,9 @@ export const sendFetch = <T>(
       sendUrl =
         sendUrl + "?" + new URLSearchParams({ ...gParams, ...other.params });
     }
+    if (other.noToken) {
+      delete gHeaders.token
+    }
   }
   lifeHook.forEach(({ start }) => start());
 
@@ -48,9 +51,9 @@ export const sendFetch = <T>(
     ...init,
     headers: headers
       ? {
-          ...headers,
-          ...gHeaders,
-        }
+        ...headers,
+        ...gHeaders,
+      }
       : gHeaders,
   })
     .then((res) => {

+ 2 - 0
src/request/organization.ts

@@ -73,6 +73,8 @@ export const registerOrganization = (params: any) => {
     return sendFetch<ResResult>(URL.registerOrganization, {
         method: "post",
         body: JSON.stringify({ ...params, password, confirmPwd: password }),
+    }, {
+        noToken: true
     });
 
 }