Skip to content

Commit

Permalink
get-edn bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Apr 13, 2024
1 parent 30d0375 commit 6c0fc3a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/pinkgorilla/repl/cljs/http.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns pinkgorilla.repl.cljs.http
(:require
[clojure.edn :as edn]
;[ajax.core]
[taoensso.timbre :as timbre :refer-macros [trace debug debugf info warn error]]
[cljs.core.async :refer [<! >! chan close!] :refer-macros [go]]
[cljs-http.client :as http]
[cemerick.url :as url]
Expand All @@ -13,14 +13,20 @@
})]
(go (let [response (<! (http/get url opts))
body (:body response)
_ (println "body: " body "type: " (type body))
_ (info "body: " body "type: " (type body))
data (-> body process)]
(swap! a assoc-in path data)
nil)))))

(def get-str (make-get identity))

(def get-edn (make-get identity)) ; edn/read-string

(defn parse-edn [s]
(if (string? s)
(edn/read-string s)
s))

(def get-edn (make-get parse-edn))

(defn parse-json [s]
(-> s js/JSON.parse js->clj))
Expand Down

0 comments on commit 6c0fc3a

Please sign in to comment.