Fork me on GitHub
#reitit
<
2018-12-03
>
heyarne21:12:29

hi! first of all: thanks for reitit, i like it a lot

heyarne21:12:54

now to my question: i'm using reitit in a re-frame app that's essentially a frontend to an api that i don't have any control over. some of the endpoints need authentication, some don't, and in addition to binary logged-in-logged-out state there's user roles that have to be considered.

heyarne21:12:48

so it's esentially like this: navigate somewhere, check user permissions / login status, if everything's ok: fetch data and display it, if not: show login screen and redirect to previous route on successful login

heyarne21:12:35

i implemented this with the old reitit pre-0.2.0 (i think?). it's a bit messy tbh because i used reitit on a very low level. any guidance on how to migrate?

heyarne21:12:55

i found https://metosin.github.io/reitit/frontend/controllers.html but some actual code would be super nice

heyarne21:12:47

you can see the data dependencies are declared close to the router, which i think in hindsight wasn't the smartest move. i'd like to have each component declare: i need those permissions and these are the events that should happen when you try to display me... at least i think i'd like to have it like this. any opinions on this very appreciated!

heyarne21:12:47

uuuuh wait. 😄 i mixed up reitit and bide, oops

heyarne21:12:04

but i think i could do exactly what i want with reitit, no? i think at some point in the past i just mashed both libraries together in my head