DEV Community

Global HTTP request and response handling with the Axios interceptor

Tero Auralinna on March 26, 2019

This is a short example of how to catch all Axios HTTP requests, responses, and errors. Catching is implemented with the Axios feature called inter...
Collapse
 
kumaravnish profile image
kumaravnish

This doesn't seem to work with axios 0.19.x. Any idea how to pass the handleError flag in the latest version of axios?

Collapse
 
phatnh96 profile image
Nguyễn Huy Phát

The article is quite helpful, thank you

Collapse
 
cajuuh profile image
Pedro Alcântara

Thank you very much, i knew the concept never knew how to apply it

Collapse
 
mteheran profile image
Miguel Teheran

Great! thanks

Collapse
 
isajal07 profile image
Sajal Shrestha

Hi Tero, How can I include data(body) while doing a post API request in Axios Interceptor?

Collapse
 
mikepattyn profile image
Mike Pattyn

This fails when using typescript because the AxiosRequestConfig does not has the handlerEnabled property.