Fork me on GitHub
#re-frame
<
2019-05-24
>
abdullahibra00:05:12

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:

abdullahibra00:05:28

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

oconn11:05:27

@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). https://github.com/oconn/re-frame-routing#route-middleware.

👍 8