Authenticated Routes and notFoundComponent
Hi, I currently have a createRootRoute with a notFoundComponent, however I want different behaviour if the user is authenticated or not. I have a bunch of routes that are available to not logged in users, but when they navigate to a route that doesn't exist, I want to send them to the login page. When they are logged in an within the authenticated section of the app I want to show them a proper 404 page. I handle authenticated routes in other places like the docs say, with the beforeLoad and a redirect there, however this does not seem possible with notFoundComponent. I have solved this for now with a check and a useNavigate within the notFoundComponent but this does not feel right. Any other ideas?
0 Replies