-
Hello, I have followed the authenticated routes with context example now which already showed got me a working auth setup. But I'm not sure how I can add the
I'd really appreciate if someone could point me into the right direction. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
https://tanstack.com/router/latest/docs/framework/react/guide/authenticated-routes this one will help you, for me i just do
but i still have problem with how to redirect again after the user finished the authentication, if you find a working way, please share |
Beta Was this translation helpful? Give feedback.
-
Ok, I found out a structure that works for me:
That way I can also define a Layout for each in either |
Beta Was this translation helpful? Give feedback.
-
Hey guys, I also had same requirement where i need to login before anything, and to have base layout for entire app routes/
__root.tsx
_auth.tsx <-- check login context, if not loggedin redirect to /login, This have base layout for entire app
_auth/
index.tsx <- this act as / , That page is showed inside base layout
about.tsx <- /about , everything is loggedin and follow base layout
login/
index.lazy.tsx
Hope this is good way of doing, please share if anyone have better structure |
Beta Was this translation helpful? Give feedback.
Ok, I found out a structure that works for me:
That way I can also define a Layout for each in either
_auth.tsx
or_authenticated.tsx
with thecomponent
attribute in the route and render an<Outlet />
at the appropriate position.