Is there a way to use interceptors in tanstack query ?
A few days ago i learn how to use interceptors.request/response with axios and know i am curious if tanstack i can do the same
JUst a bit of code about how i do it:
i am curios how can i do in tanstack the same
6 Replies
automatic-azure•14mo ago
you can use axios with react-query ... it's not either/or
eastern-cyanOP•14mo ago
so i can create a wrapper in axios and then use it in react-query ? @TkDodo 🔮
harsh-harlequin•14mo ago
Yes, I always do this.
eastern-cyanOP•14mo ago
roger roger
danke
@caproll. do you have a basic example ?
and if u may want to share it will be a great example for me to understand it
thx in advance
harsh-harlequin•14mo ago
API function is in services folder
React query hook is in hooks folder
Axios setup is in config folder
https://github.com/taufanp/mployee
eastern-cyanOP•14mo ago
danke