add config REQUEST_CACHE

This commit is contained in:
sc 2021-07-15 09:24:56 +08:00
parent 82365f155a
commit b21fdaebc2
2 changed files with 9 additions and 2 deletions

View File

@ -10,10 +10,13 @@ const DEFAULT_CONFIG = {
//MOCK接口地址
MOCK_URL: "https://www.fastmock.site/mock/44c807475f7eeba73409792255781935/api",
//TokenName
TOKEN_NAME: "Authorization",
//请求是否开启缓存
REQUEST_CACHE: false,
//布局 默认default | 通栏header | 经典menu | 功能坞dock
//dock将关闭标签和面包屑栏
LAYOUT: 'default',

View File

@ -14,6 +14,10 @@ axios.interceptors.request.use(
if(userInfo){
config.headers[sysConfig.TOKEN_NAME] = userInfo.token
}
if(!sysConfig.REQUEST_CACHE && config.method == 'get'){
config.params = config.params || {};
config.params['_'] = new Date().getTime();
}
return config;
},
(error) => {