Created
June 8, 2017 09:06
-
-
Save anonymous/8d9fe204c144a8b11155e0cb33d97d1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn api-call-with-cb [api-call cb] | |
(go (let [resp (<! (api-call))] | |
(if (= 200 (:status resp)) | |
(cb (:body resp)) | |
(treat-error resp))))) | |
(defn api-fetch | |
([api-call cb] (api-call-with-cb api-call cb)) | |
([api-call] (api-call-without-cb api-call))) | |
(go | |
(prn "Items " @items) ;; prints items collection with data in it | |
(doseq [item @items] | |
(prn "this is t " item) ;; prints a map (one item of @items collection) | |
(<! (api-fetch #(get-stuff (:_id item)) ;; chrome dev tools show the request made with :_id param read correctly | |
(fn [aux] | |
;; this prints 30, when built with: lein do clean, uberjar | |
;; print a map item of @item in develpment mode | |
;; what, how and why is this happening?? | |
(prn "Item in this fn" item) | |
(reset! rez aux)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment