T
TanStack2y ago
correct-apricot

Authenticated Routes

Hi everyone, I'm new to Tanstack Router and I'm encountering some difficulties. How can I centralize this type of validation across multiple routes? For instance, in the provided example where I have 'profile' routes, I also want to apply the same validation to 'registrations' routes to check if the user is logged in.
No description
2 Replies
continuing-cyan
continuing-cyan2y ago
You can create a pathless layout route that wraps all of your authenticated routes and just enforces the auth check
correct-apricot
correct-apricotOP2y ago
And how can I do this? Do you have some example? I also tried to create a layout that I wanted to wrap all my other routes but I couldn’t make it right I managed to do it! thx

Did you find this page helpful?