Commit d663bdb6 authored by 张伯涛's avatar 张伯涛

接口调用传token的时候加上Bearer

parent b91b53d9
...@@ -158,9 +158,7 @@ const transform: AxiosTransform = { ...@@ -158,9 +158,7 @@ const transform: AxiosTransform = {
const token = getToken(); const token = getToken();
if (token && (config as Recordable)?.requestOptions?.withToken !== false) { if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
// jwt token // jwt token
(config as Recordable).headers.Authorization = options.authenticationScheme (config as Recordable).headers.Authorization = 'Bearer ' + token;
? `${options.authenticationScheme} ${token}`
: token;
} }
return config; return config;
}, },
...@@ -230,8 +228,6 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) { ...@@ -230,8 +228,6 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
{ {
// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#authentication_schemes // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#authentication_schemes
// authentication schemes,e.g: Bearer // authentication schemes,e.g: Bearer
// authenticationScheme: 'Bearer',
authenticationScheme: '',
timeout: 10 * 1000, timeout: 10 * 1000,
// 基础接口地址 // 基础接口地址
// baseURL: globSetting.apiUrl, // baseURL: globSetting.apiUrl,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment