Answer the question
In order to leave comments, you need to log in
How to stop an asynchronous queue?
Have a request
let CancelToken = axios.CancelToken;
let cancel;
loadData: _.debounce(function (paramLogOut=false) {
if (cancel != undefined && paramLogOut) {
cancel();
return true;
}
axios
.post(params.url, params.data, {
cancelToken: new CancelToken(function executor(c) {
cancel = c;
})
})
.then(response => {
... response
})
.catch((error) => {
if (!axios.isCancel(error)) {
this.showNoty('error', 'Что-то пошло не так... Данные не удалось загрузить');
console.error(error);
}
})
}, 75)
logOut() {
if (window.location.origin.search('127.0.0.1:9090') !== -1) {
window.location.href = app.$axios.defaults.baseURL + '/Account/Logout';
} else {
window.location.href = '/Account/Logout';
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question