Skip to content

Instantly share code, notes, and snippets.

@mheld

mheld/thing.cljs Secret

Created September 7, 2016 21:13
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 mheld/dc289aa7c5dfc7612ac2d6ba414aeb74 to your computer and use it in GitHub Desktop.
Save mheld/dc289aa7c5dfc7612ac2d6ba414aeb74 to your computer and use it in GitHub Desktop.
(r/reg-event-fx
:login
(fn [{:keys [db]} [_ email password]]
{:db (assoc-in db [:pages :loading?] true)
:http-xhrio {:method :post
:uri "http://localhost:3000/api/v1/auth/sign_in.json" ; todo: dynamic URLs!
:timeout 8000
:format :json
:keywords? :true
:params {:email email :password password}
:response-format (json-response-format {:keywords? true}) ;; optional see API docs
:on-success [:good-login]
:on-failure [:bad-http-result "sometihng went wrong..."]}}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment