This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-28
Channels
- # aleph (1)
- # arachne (4)
- # beginners (13)
- # boot (18)
- # clara (7)
- # cljs-dev (156)
- # cljsrn (278)
- # clojure (163)
- # clojure-conj (5)
- # clojure-dev (1)
- # clojure-losangeles (1)
- # clojure-poland (2)
- # clojure-sg (1)
- # clojure-spec (15)
- # clojure-uk (17)
- # clojurescript (275)
- # data-science (5)
- # datomic (23)
- # emacs (10)
- # leiningen (1)
- # lumo (16)
- # off-topic (98)
- # onyx (10)
- # parinfer (83)
- # re-frame (18)
- # reagent (47)
- # remote-jobs (1)
- # ring (1)
- # ring-swagger (5)
- # rum (6)
- # specter (8)
- # vim (5)
@yedi think @lwhorton meant to send you this: http://reagent-project.github.io/news/news050.html
I’m writing a ClojureScript app w/Reagent/Re-frame and I’m wondering how to properly handle logout when the user’s token expires. I’m assuming I should do something like have an AJAX interceptor that checks for 401s and then dispatches a “logout” event?
Assuming you are using something like re-frame-http-fx
you would make the on-failure
handler set some state in app-db
to capture the logged out state
Are you guys/gals more fond of pedestal than ring cause of the use of interceptors in re-frame?
yada here @lockdown- 🙂
yada is also interceptor based, async, very http compliant and gives you swagger for free - it ticked all my boxes
@lockdown- I've been using Pedestal recently. As you said, I like sticking w/ interceptors, but also it was easy to do Server Sent Events.
Hello. I need a piece of advice regarding event handler organization. For example i have some handler for UI event :form/init
which calls :user/fetch
. UI shows loading progress and so :form/init
should know when :user/fetch
is done (or when specific :user/fetch.done
is called). How can i know this inside :form/init
while making :user/fetch
:user/fetch.done
generic enough (don't put inside logic for this specific form)?
@nidu You can't dispatch an event inside of an event.
You could have a loading state in the app-db that gets updated by :user/fetch
and :user/fetch.done
then have your view subscribe on that.
@akiroz but i can dispatch another event in reg-event-fx
via dispatch
, isn't it the same?
Yeah, that's the point. I'd like :user/fetch
to be used e.g. in different forms and every form would like to know when user is fetched. Probably these generic functions shouldn't be events?
@nidu nope, calling dispatch
inside of an event will queue up the event. it gets handled after the current one is completed.