Axios Periksa apakah panggilan sudah berjalan
var numberOfAjaxCAllPending = 0;
// Add a request interceptor
axios.interceptors.request.use(function (config) {
numberOfAjaxCAllPending++;
// show loader
return config;
}, function (error) {
return Promise.reject(error);
});
// Add a response interceptor
axios.interceptors.response.use(function (response) {
numberOfAjaxCAllPending--;
console.log("------------ Ajax pending", numberOfAjaxCAllPending);
if (numberOfAjaxCAllPending == 0) {
//hide loader
}
return response;
}, function (error) {
numberOfAjaxCAllPending--;
if (numberOfAjaxCAllPending == 0) {
//hide loader
}
return Promise.reject(error);
});
Singh99