Fork me on GitHub

i'm using bidi and pushy to define routes of my app, but my app have multi role UI, admin, normal user so i would like to set the root route based on the logged in role, what i currently have:


is this right, or how can i better do this part using bidi?


@abdullahibra There are a few alternative ways you could go about it. If you have your authentication state prior to the router being initialized, you could generate the route map which would include only the routes available to the current user. Another option could be to register both routes (since they are different) and protect them. I wrote a small wrapper around bidi and pushy that I primarily used to track route state in re-frame, but there’s an idea in there that I called route middleware which solves this problem (Note create-route-middleware will change in the future, but the idea will stay the same).

👍 8