How do i write routes which update automatically based on if authenticated or not
Lets say that I have the below code and when i hit root path(
/
) i want to navigate to /login
if I am not authenticated and /orders
if I am authenticated. I tried using <Show>
and it was not helping me out. I checked if the <Router>
navigate("/orders")
is changing the url to /orders
but the page doesn't load the respective component
I am a noob in Solidjs. Have been learning it from yesterday only. So any pointers or additional info would help me
App.jsx
3 Replies
My index.jsx has
render(() => (<Router><App/></Router>), document.getElementById('root'));
seems i had 2 <Router>
one in index.jsx and App.jsx and seems that was causing the issuethe auth-js documentation has a decent example on how to set up protected routes iirc