Explorar el Código

fix(axios): option `withToken` not work

无木 hace 3 años
padre
commit
d509e897be
Se han modificado 1 ficheros con 1 adiciones y 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}`