Fork me on GitHub
#re-frame
<
2017-12-23
>
chang05:12:36

I tried to emulate re-frame's [talking to other services](https://github.com/Day8/re-frame/blob/master/docs/Talking-To-Servers.md) code, with the following example:

(rf/reg-event-fx
  :request-address-data

  (fn [_ [_ addr]]

    {:http-xhrio {:method         :get
                  ;; 
                  :uri (str "" (name addr) "/balance")
                  :response-format (ajax/json-request-format)
                  :on-failure [:failed-get-request]
                  :on-success [:address-data-loaded]}}))
Now, when the data arrives, the on-failure callback, :failed-get-request gets invoked instead of the on-success which got me very confused as the two are like night and day. Any quick pointers, I might want to dig further in.

atticmaverick18:12:18

@mohamedhayibor did the response look good? On the on-failure event check your response. Maybe something went wrong

Keith18:12:36

@mohamedhayibor check your :response-format. It should be ajax/json-response-format

atticmaverick18:12:29

and maybe you need to specify a format (request format)