(ns comic-reader.api
  (:require [ajax.core :refer [GET POST]]))

(defn error-handler [{:keys [status status-text]}]
  (.log js/console (str "something bad happened: " status " " status-text)))

(defn get-sites [callback]
  (GET "/api/v1/sites" {:handler callback
                        :error-handler error-handler
                        :response-format :edn}))

(ns comic-reader.api
  (:require [re-frame.core :refer [dispatch]]
            [ajax.core :refer [GET POST]]))

(defn error-handler [{:keys [status status-text]}]
  (.log js/console (str "something bad happened: " status " " status-text)))

(defn get-sites []
  (GET "/api/v1/sites" {:handler #(dispatch [:site-list %])
                        :error-handler error-handler
                        :response-format :edn}))

Rewrite API call to dispatch a re-frame event
Rewrite API call to dispatch a re-frame event

RadicalZephyr/comic-reader,RadicalZephyr/comic-reader