-
Is there the possibility to use the native axios functionality for handling errors in the interceptor? For example like something from the axios docs. My use case would be refreshing a jwt access token when getting a 401 response and resending the original request. Thanks in advance 🙏 // Add a response interceptor
axios.interceptors.response.use(function (response) {
// Any status code that lie within the range of 2xx cause this function to trigger
// Do something with response data
return response;
}, function (error) {
// Any status codes that falls outside the range of 2xx cause this function to trigger
// Do something with response error
return Promise.reject(error);
}); |
Beta Was this translation helpful? Give feedback.
Answered by
mrlubos
Jul 22, 2024
Replies: 1 comment 3 replies
-
Hey @rupert-br, are you not able to use the response object to handle error states? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, there's now a standalone Axios client that implements native Axios interceptors through
client.instance
. You can download it from npm and here are the docs https://heyapi.vercel.app/openapi-ts/clients.html#axios