pace
pace copied to clipboard
Vuejs + Axios didnt work
Pace.js, dont detect axios call on vuejs 2.0
I am having the same issue. Any news?
Me too.
#436
This was my solution.
var numberOfAjaxCAllPending = 0;
// Add a request interceptor
axios.interceptors.request.use(function (config) {
numberOfAjaxCAllPending++;
Pace.start()
return config;
}, function (error) {
return Promise.reject(error);
});
// Add a response interceptor
axios.interceptors.response.use(function (response) {
numberOfAjaxCAllPending--;
// Do something with response data
if (numberOfAjaxCAllPending == 0) {
Pace.stop()
}
return response;
}, function (error) {
numberOfAjaxCAllPending--;
if (numberOfAjaxCAllPending == 0) {
Pace.stop()
}
return Promise.reject(error);
});
@the94air @VSG24 @angelmartz
it looks like it is the only way. Thanks @zeditio.
Use Pace.start() and Pace.stop() instead.
thanks @setefocos . I updated the code
@zeditio It looks even better if you use Pace.restart()
instead of Pace.start()
but it also stop before the end of the actual ajax request.
Use : https://github.com/hilongjw/vue-progressbar
You guys experience the progress bar finishing before calling .stop
? is there a way around that?