Skip to content

Instantly share code, notes, and snippets.

@danielneal
Forked from qleguennec/effects.cljs
Last active September 7, 2017 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielneal/efd8e6d9e4151a0d7f200aae0ce28a18 to your computer and use it in GitHub Desktop.
Save danielneal/efd8e6d9e4151a0d7f200aae0ce28a18 to your computer and use it in GitHub Desktop.
(rf/reg-fx
:POST
;; on-success is a reframe event vector [:foo/bar ...]
(fn [{:keys [url params on-success on-fail]}]
(take! (http/post url {:form-params params})
;; conj the results into it so the response gets put into the event
;; like this:
;; [:foo/bar <result>]
#(re-frame.core/dispatch (conj on-success %)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment