Procházet zdrojové kódy

fix(axios): option `withToken` not work

无木 před 3 roky
rodič
revize
d509e897be
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      src/utils/http/axios/index.ts

+ 1 - 1
src/utils/http/axios/index.ts

@@ -122,7 +122,7 @@ const transform: AxiosTransform = {
   requestInterceptors: (config, options) => {
     // 请求之前处理config
     const token = getToken();
-    if (token && options?.requestOptions?.withToken !== false) {
+    if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
       // jwt token
       config.headers.Authorization = options.authenticationScheme
         ? `${options.authenticationScheme} ${token}`