T
TanStack3y ago
other-emerald

fetch at the same time + expired token issue

I have several useQuery, which are all set to be fetched every 10 mins, and only fetch when there is a token and the token is valid. The token is always set to expired every 10 mins. When the token not valid, we got 401 status code then we refresh the token. So now the issue is that I found they all call at the same time, so my "fetch token" function is called too many times (at the same time). So, what is the best way to just got one of the token call? So ideally I should get one 401, it replaces the token immediately, instead of having all the endpoints calling and replacing token several times in a split of second?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?