From 0b23e2ade63d6952271e221526238a494c2b9fbd Mon Sep 17 00:00:00 2001 From: kapware Date: Thu, 13 Oct 2016 18:29:00 +0200 Subject: [PATCH 1/2] Added :response-format, without that it fails. Without this line the event fails as the response is not properly formatted. --- docs/Talking-To-Servers.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Talking-To-Servers.md b/docs/Talking-To-Servers.md index 4ac735c..2544a65 100644 --- a/docs/Talking-To-Servers.md +++ b/docs/Talking-To-Servers.md @@ -128,6 +128,7 @@ Here's our rewrite: ;; we return a map of (side) effects {:http-xhrio {:method :get :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] :on-success [:process-response] :on-failure [:bad-response]} :db (assoc db :loading? true)})) From 35f2722be40440f946af2a96b9c1633a7eb5789c Mon Sep 17 00:00:00 2001 From: Shaun Mahood Date: Thu, 13 Oct 2016 10:41:02 -0600 Subject: [PATCH 2/2] Update Talking-To-Servers.md --- docs/Talking-To-Servers.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/Talking-To-Servers.md b/docs/Talking-To-Servers.md index 2544a65..a3ca059 100644 --- a/docs/Talking-To-Servers.md +++ b/docs/Talking-To-Servers.md @@ -117,6 +117,7 @@ Here's our rewrite: ```clj (ns my.app.events (:require + [ajax.core :as ajax] [day8.re-frame.http-fx] [re-frame.core :refer [reg-event-fx])) @@ -128,7 +129,7 @@ Here's our rewrite: ;; we return a map of (side) effects {:http-xhrio {:method :get :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-failure [:bad-response]} :db (assoc db :loading? true)}))