Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loading bar doesnt disappear on connection refused #14

Open
ryanm352 opened this issue Apr 12, 2019 · 1 comment
Open

loading bar doesnt disappear on connection refused #14

ryanm352 opened this issue Apr 12, 2019 · 1 comment

Comments

@ryanm352
Copy link

When axios encounters a connection refused error, the progress bar doesn't disappear when the request has failed.

@ryanm352
Copy link
Author

ryanm352 commented Apr 12, 2019

fix:

       setupStopProgress = () => {
        const responseFunc = (response) => {
            if ((--this.requestsCounter) === 0) {
                NProgress.done();
            }
            return response;
        };

        const errorFunc = (error) => {
            return Promise.reject(error).then(this.reset, this.reset);
        };
        this.instance.interceptors.response.use(responseFunc, errorFunc);
    };

    reset() {
        NProgress.remove();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant