Help with T3 Stack. Next.js 15 + tRPC + Tanstack Query
Hi, I use the T3 stack with Next.js, tRPC, and Auth.js.
I have an issue in my app where whenever my user's session expires, we get the UNAUTHORIZED error from our protectedprocedure, but I want to automatically redirect the user to our /login page after the session expires. How is this usually done efficiently?
1 Reply
The way I did it - I created a HOC that catches errors and handles them appropriately. The I wrapped every single page in that.
I also set the usequery to throw on error, so it can catch it.
I dunno if that is how people do it, but it works well for me