gemercheung hace 1 año
padre
commit
44bcf852a0
Se han modificado 2 ficheros con 9 adiciones y 4 borrados
  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
     });
 
 }