fix(axios): option withToken not work

This commit is contained in:
无木 2021-06-30 01:07:27 +08:00
parent 424b171e0d
commit d509e897be

View File

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