This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-03
Channels
- # adventofcode (198)
- # aleph (10)
- # announcements (7)
- # aws (17)
- # beginners (353)
- # boot (1)
- # calva (13)
- # cider (18)
- # cljdoc (2)
- # cljs-dev (11)
- # cljsrn (1)
- # clojure (87)
- # clojure-austin (1)
- # clojure-brasil (2)
- # clojure-greece (13)
- # clojure-italy (18)
- # clojure-kc (2)
- # clojure-nl (9)
- # clojure-quebec (1)
- # clojure-russia (1)
- # clojure-spec (55)
- # clojure-uk (114)
- # clojurescript (18)
- # clojurex (14)
- # code-reviews (5)
- # core-async (17)
- # cursive (23)
- # data-science (1)
- # datomic (82)
- # docker (8)
- # duct (10)
- # emacs (8)
- # figwheel (3)
- # figwheel-main (5)
- # fulcro (13)
- # hyperfiddle (8)
- # jobs (1)
- # midje (1)
- # mount (1)
- # nrepl (2)
- # off-topic (72)
- # om (2)
- # pathom (10)
- # portkey (2)
- # re-frame (9)
- # reagent (3)
- # reitit (9)
- # ring-swagger (14)
- # schema (1)
- # shadow-cljs (91)
- # spacemacs (21)
- # sql (6)
- # tools-deps (19)
- # unrepl (9)
- # vim (41)
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.
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
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?
i found https://metosin.github.io/reitit/frontend/controllers.html but some actual code would be super nice
this is the implementation right now: https://github.com/heyarne/airsonic-ui/blob/master/src/cljs/airsonic_ui/routes.cljs
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!