Update Talking-To-Servers.md

This commit is contained in:
Shaun Mahood 2016-10-13 10:41:02 -06:00 committed by GitHub
parent 0b23e2ade6
commit 35f2722be4
1 changed files with 2 additions and 1 deletions

View File

@ -117,6 +117,7 @@ Here's our rewrite:
```clj ```clj
(ns my.app.events (ns my.app.events
(:require (:require
[ajax.core :as ajax]
[day8.re-frame.http-fx] [day8.re-frame.http-fx]
[re-frame.core :refer [reg-event-fx])) [re-frame.core :refer [reg-event-fx]))
@ -128,7 +129,7 @@ Here's our rewrite:
;; we return a map of (side) effects ;; we return a map of (side) effects
{:http-xhrio {:method :get {:http-xhrio {:method :get
:uri "http://json.my-endpoint.com/blah" :uri "http://json.my-endpoint.com/blah"
:response-format (ajax/json-response-format {:keywords? true}) ;; <-- this is very important, don't forget to require [ajax.core :as ajax] :response-format (ajax/json-response-format {:keywords? true})
:on-success [:process-response] :on-success [:process-response]
:on-failure [:bad-response]} :on-failure [:bad-response]}
:db (assoc db :loading? true)})) :db (assoc db :loading? true)}))