add config TOKEN_PREFIX
This commit is contained in:
parent
b21fdaebc2
commit
77bc119c35
|
@ -14,6 +14,9 @@ const DEFAULT_CONFIG = {
|
|||
//TokenName
|
||||
TOKEN_NAME: "Authorization",
|
||||
|
||||
//Token前缀,注意最后有个空格,如不需要需设置空字符串
|
||||
TOKEN_PREFIX: "Bearer ",
|
||||
|
||||
//请求是否开启缓存
|
||||
REQUEST_CACHE: false,
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ axios.interceptors.request.use(
|
|||
(config) => {
|
||||
let userInfo = tool.data.get("user");
|
||||
if(userInfo){
|
||||
config.headers[sysConfig.TOKEN_NAME] = userInfo.token
|
||||
config.headers[sysConfig.TOKEN_NAME] = sysConfig.TOKEN_PREFIX + userInfo.token
|
||||
}
|
||||
if(!sysConfig.REQUEST_CACHE && config.method == 'get'){
|
||||
config.params = config.params || {};
|
||||
|
|
Loading…
Reference in New Issue