统一配置默认超时时间:
const httpAxios = axios.create();//创建实例
let Config = {
TIMEOUT: 6000,//设置超时时间为6秒
baseURL: {
dev: window.BASEURL_01,
prod: ''
}
};
httpAxios.defaults.timeout = Config.TIMEOUT;
项目中普通api接口请求:
export function postRefresh(data) {
return request({
url: '/api/operation/payoutOrder/refresh',
method: 'post',
data
})
}
重设超时时间的接口请求:
export function postRefresh(data) {
return request({
url: '/api/operation/payoutOrder/refresh',
method: 'post',
timeout: 100 * 1000,
data
})
}