Skip to content

responseInterceptor does not get called on error #33

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

Closed
uptownhr opened this issue Sep 19, 2017 · 4 comments
Closed

responseInterceptor does not get called on error #33

uptownhr opened this issue Sep 19, 2017 · 4 comments

Comments

@uptownhr
Copy link
Contributor

uptownhr commented Sep 19, 2017

One good place to put some global error handlers is on the responseInterceptor, but looks like it is not being called when the request errors.

responseInterceptor: (response, { store, redirect }) => {
      console.log('response', response)
      if (response.status.code == 401) {
        store.dispatch('logout')
        redirect('/login')
      }
      return response
    }

using version: 4.3.0

This question is available on Nuxt.js community (#c27)
@pschmidt88
Copy link
Contributor

Yeah, I got the same problem here.

@ahDDD
Copy link

ahDDD commented Jan 12, 2018

I'm already set disableDefaultErrorHandler to true, but still nothing happens..

@CyberNika
Copy link

+1

@pi0
Copy link
Member

pi0 commented Jan 28, 2018

With 5.x version, we have deprecated responseInterceptor. Instead, there is a better solution to use nuxt plugins.

Please see Extending Axios section and don't forget to migration guide :)

@pi0 pi0 closed this as completed Jan 28, 2018
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

5 participants