Selaa lähdekoodia

fix(axios): option `withToken` not work

无木 3 vuotta sitten
vanhempi
commit
d509e897be
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  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}`