Explorar o código

fix(axios): option `withToken` not work

无木 %!s(int64=3) %!d(string=hai) anos
pai
achega
d509e897be
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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}`