How to handle redirect from query - TanStack