-
Notifications
You must be signed in to change notification settings - Fork 158
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
@nuxtjs/axios - adding interceptor #73
Comments
Just moved the interceptor to directly before the get request within |
Actually, this is an error in the plugin. // Don't throw unhandled promises in SSR context
return this.app._nuxt.error.call({$options: this.app}, {
message: error.message,
statusCode: error.statusCode
}) Because in SSR the error isn't passed I can't catch it and do whatever I want. How can we get around this one? |
@silverbackdan In latest commit, I've entirely removed that auto error handling logic. Would be nice having your comments on it before next release :) |
@pi0 Ooo I quite like that :) I didn't know if there was a reason why the promise wasn't rejected on server-side before but it is nice still having the standardised status and message. It'd certainly work for my needs still! |
Thanks for your review. Actually i think the problem with handled promises should be fixed on Nuxt itself because both |
That's much better, I'll update to the latest commit tomorrow morning. Thanks for taking the time on this module. |
If I add an interceptor in middleware, it works fine from the client side, but for SSR the interceptor is not used when an Axios request is in a component's
asyncData
method.When logging I can see that the interceptor is called first, and then when the request in async data is called, I can't log any output from within the interceptor signifying that a 403 status code has been detected.
In my middleware:
called from asyncData
This works when I just change page as a user though. Am I going about this the wrong way?
The text was updated successfully, but these errors were encountered: