Is there a better way to make authenticated routes ?
Hey! Anybody knows if there's a better way to write specific routes that can be only accessed when a certain condition is fulfilled ? (See attachment: for now in every pages component I check manually with a
Show
and if true, then redirect to a fallback page using Navigate
)
I say "better way" because I honestly don't know if there's anything else better than that
No Solid-Start, no SSR, only SPA (vite
+ vite-plugin-solid
) and @solidjs/router
Thanks !2 Replies
In order to "protect" some routes, I usually render a Layout with
<Outlet />
in it.
And inside my Layout component, I have all the logic to guard against unauthenticated access 😉oh, interesting 🤔
do you have a very minimal example to see how does it would look like ?