Closed IvannikovG closed 10 months ago
I am using an example provided in README.
(rf/reg-event-db :good-http-result (fn [db [_ result]] (println db) (assoc db :api-result result)))
(rf/reg-event-db :bad-http-result (fn [db [_ result]] (assoc db :api-result result)))
(rf/reg-event-fx ;; note the trailing -fx :handler-with-http ;; usage: (dispatch [:handler-with-http]) (fn [{:keys [db]} _] ;; the first param will be "world" {:db (assoc db :show-twirly true) ;; causes the twirly-waiting-dialog to show?? :http-xhrio {:method :get :uri "https://api.github.com/orgs/day8" :timeout 8000 :response-format (ajax/json-response-format {:keywords? true}) :on-success [:good-http-result] :on-failure [:bad-http-result]}}))
In browser I get "Error: unrecognised format"
If I specify format: ":format :json" (this and other endpoints I tried return json), then I get nil when I print db in :good-http-result
To fix one should bump down dependency of ajax-core to the same this library uses
I am using an example provided in README.
(rf/reg-event-db :good-http-result (fn [db [_ result]] (println db) (assoc db :api-result result)))
(rf/reg-event-db :bad-http-result (fn [db [_ result]] (assoc db :api-result result)))
(rf/reg-event-fx ;; note the trailing -fx :handler-with-http ;; usage: (dispatch [:handler-with-http]) (fn [{:keys [db]} _] ;; the first param will be "world" {:db (assoc db :show-twirly true) ;; causes the twirly-waiting-dialog to show?? :http-xhrio {:method :get :uri "https://api.github.com/orgs/day8" :timeout 8000 :response-format (ajax/json-response-format {:keywords? true}) :on-success [:good-http-result] :on-failure [:bad-http-result]}}))
In browser I get "Error: unrecognised format"
If I specify format: ":format :json" (this and other endpoints I tried return json), then I get nil when I print db in :good-http-result