Update the get-article to return data as a cljs map without arrays.

main
KKlochko 1 year ago
parent 00895abe0c
commit bfef190c91

@ -2,6 +2,7 @@
(:require ["pg" :refer [Client]]
[cljs.core.async :refer [go, take!, put!, >!, chan]]
[cljs.core.async.interop :refer-macros [<p!]]
[cljs.core :refer [clj->js js->clj]]
[blog.env :as env]))
(defn create-client
@ -37,8 +38,10 @@
(try
(let [res (<p! (.query client
"select * from articles where id=$1"
(cljs.core/clj->js [id])))]
(>! channel (.-rows res)))
(clj->js [id])))]
(>! channel (-> (.-rows res)
(js->clj :keywordize-keys true)
(first))))
(catch js/Error err (js/console.log (ex-cause err)))))
channel)

Loading…
Cancel
Save