接近的并发请求,拦截器会弃置掉其中一个,导致业务数据丢失。

courseware
harry 5 years ago
parent a3b29b41af
commit f1543a5b5b

@ -89,23 +89,27 @@ setpostcookie();
clearAllCookie() clearAllCookie()
if (timestamp && checkSubmitFlg === false) { if (timestamp && checkSubmitFlg === false) {
$.ajax({url:proxy,async:false,success:function(data){ $.ajax({
url: proxy, async: false, success: function (data) {
if (data.status === 0) { if (data.status === 0) {
timestamp = data.message; timestamp = data.message;
setpostcookie(); setpostcookie();
} }
}}) }
})
checkSubmitFlg = true checkSubmitFlg = true
window.setTimeout(() => { window.setTimeout(() => {
checkSubmitFlg = false; checkSubmitFlg = false;
}, 2000); }, 2000);
} else if (checkSubmitFlg === false) { } else if (checkSubmitFlg === false) {
$.ajax({url:proxy,async:false,success:function(data){ $.ajax({
url: proxy, async: false, success: function (data) {
if (data.status === 0) { if (data.status === 0) {
timestamp = data.message; timestamp = data.message;
setpostcookie(); setpostcookie();
} }
}}) }
})
checkSubmitFlg = true checkSubmitFlg = true
window.setTimeout(() => { window.setTimeout(() => {
checkSubmitFlg = false; checkSubmitFlg = false;
@ -256,11 +260,10 @@ export function initAxiosInterceptors(props) {
} }
setpostcookie(); setpostcookie();
} }
// // 拦截器导致关键的业务数据丢失,先注释
// console.log(config); // if (requestMap[config.url] === true) {
if (requestMap[config.url] === true) { // return false;
return false; // }
}
// // 非file_update请求 // // 非file_update请求
if (config.url.indexOf('update_file') === -1) { if (config.url.indexOf('update_file') === -1) {
requestMap[config.url] = true; requestMap[config.url] = true;

Loading…
Cancel
Save