rstacruz / nprogress

For slim progress bars like on YouTube, Medium, etc
http://ricostacruz.com/nprogress
MIT License
25.99k stars 1.81k forks source link

[Question] axious support #193

Closed the94air closed 6 years ago

the94air commented 6 years ago

How to integrate the progress with axios library (restart with any ajax request)?

s00d commented 6 years ago
import NProgress from 'nprogress';
NProgress.configure({
    easing: 'linear',
    speed: 350
});
Axios.defaults.transformRequest.push(function (data, headers) {
    NProgress.start();
    return data;
})

Axios.defaults.transformResponse.push(function (data, headers) {
    NProgress.done();
    return data;
})
the94air commented 6 years ago

Awesome.Pace progress is not maintained any more And nprogress is a perfect replacement. Thanks @s00d https://jsfiddle.net/the94air/bpzyyay9/

RamyRais commented 6 years ago

@the94air since the isssue is resolved could you close it?

the94air commented 6 years ago

Oops, forgot about that.