S
SolidJS•13mo ago
Vexcited

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 !
No description
2 Replies
Carere
Carere•13mo ago
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 😉
Vexcited
VexcitedOP•13mo ago
oh, interesting 🤔 do you have a very minimal example to see how does it would look like ?
Want results from more Discord servers?
Add your server