Anyone had success with setting up Axios interceptors to work properly with Tanstack start? #5603
Unanswered
ismailcherri
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
do you have a full reproducer project? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello community!
I've been using Tanstack start for a while and it is doing a great job so far.
However, one thing that is irking me is that I'm unable to make Axios interceptors to work properly with it.
Basically I want to intercept API calls to my backend and when I receive a 401 error, I want to remove the auth token from cookies so that the user can re-login again.
I used Isomorphic functions to do the logic in both Server and Client sides. I'm using
getCookie,setCookieanddeleteCookiefrom Tanstack server package for the server logic andcookie-jsfor the client logic.However, when I implement the interceptors, I loose HMR for some reason. Any change I do doesn't properly reset the server and I keep getting empty responses on backend API calls (by backend here I mean my backend API not Tanstack backend server)
Do you have a recommendation on the proper way to implement Axios interceptors?
Thanks in advance 🙏
Beta Was this translation helpful? Give feedback.
All reactions