Skip to content

Instantly share code, notes, and snippets.

@gabrielnau
Created October 15, 2016 06:35
Show Gist options
  • Save gabrielnau/6c59bbea1a7ddc8df4de875503d0b942 to your computer and use it in GitHub Desktop.
Save gabrielnau/6c59bbea1a7ddc8df4de875503d0b942 to your computer and use it in GitHub Desktop.
re-frame-http-fx usage
(reg-event-fx
:http-request
(fn [{:keys [db]} [_ {:keys [method uri on-success on-failure params]}]]
{:db db
:http-xhrio {:method method
:uri uri
:params params
:on-success on-success
:on-failure on-failure
:headers {"X-CSRF-Token" csrf-token}
:format (ajax/json-request-format)
:response-format (ajax/json-response-format {:keywords? true})}}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment