This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-17
Channels
- # aleph (4)
- # announcements (2)
- # babashka (85)
- # beginners (136)
- # calva (72)
- # clj-commons (32)
- # clj-kondo (7)
- # cljs-dev (3)
- # clojure (117)
- # clojure-europe (38)
- # clojure-nl (3)
- # clojure-norway (1)
- # clojure-uk (4)
- # clojurescript (19)
- # conjure (38)
- # core-logic (2)
- # cursive (10)
- # datalevin (1)
- # datalog (1)
- # datomic (6)
- # events (2)
- # fulcro (16)
- # google-cloud (5)
- # graphql (10)
- # gratitude (3)
- # hugsql (3)
- # luminus (5)
- # membrane-term (12)
- # missionary (2)
- # nextjournal (5)
- # off-topic (3)
- # pedestal (2)
- # polylith (7)
- # portal (3)
- # re-frame (6)
- # reagent (26)
- # reclojure (8)
- # releases (3)
- # reveal (5)
- # shadow-cljs (14)
- # spacemacs (20)
- # sql (3)
- # tools-build (3)
- # web-security (9)
Prior to initializing my app and pulling any actual app data, I have to do a get request to get authorization token which I will then send with every api request - my question is, how do I make my app "wait" until this token request is done prior to initializing and dispatching any other requests? My app is done with re-frame. Any help is appreciated!
You have some event somewhere that initializes the whole app-db and kicks off the app. You can dispatch that event not on the render but on the auth token reception.
I’m using async flow https://github.com/day8/re-frame-async-flow-fx for something similar, maybe it helps
Don’t use async flow for this. The least horrible solution I have found is to use promesa at app bootup to make your initial app-db
(p/let [auth-response (... make request to get token ...)]
(let [initial-db {:auth-token (... auth-response ...)}]
(rf/dispatch-sync [:init initial-db])))