TanStackT
TanStack2y ago
12 replies
colossal-harlequin

Protected routes with query

I have my API which has an auth system which uses sessions via cookies. The problem is that to check if the user is logged in, I make a request to /auth/me. I would like on my router to make a request to this endpoint (API) to check if the user is connected or not. I want to know if it is possible to do this? If not, what is the best way to check if the user is logged in?
FYI, I use Tanstack Query to do my queries.
Was this page helpful?