axios.interceptors.request.use(
config => {
startLoading();
config['cancelToken'] = new axios.CancelToken(function executor(cancel) {
Vue.$httpRequestList.push(cancel)
})
if (auth.loadHeadersFlag() === "basic") {
config.headers["Content-Type"] = "application/x-www-form-urlencoded";
config.headers["Authorization"] =
"abcde " +
app.util.base64Encode(
app.config.globle.client_id + ":" + app.config.globle.client_secret
);
} else if (auth.loadAccessToken()) {
config.headers["Content-Type"] = "application/json";
config.headers.Authorization =
auth.loadTokenType() + " " + auth.loadAccessToken();
}
return config;
},
error => {
return Promise.reject(error);
}
);
clearHttpRequestingList() {
if (Vue.$httpRequestList.length > 0) {
Vue.$httpRequestList.forEach(item => {
item('interrupt')
})
Vue.$httpRequestList = []
}
}
app.util.clearHttpRequestingList();