 (defn get-playlist []
   (GET "http://localhost:8080/api/queue"
        {:handler #(update-state! :playlist (% "items"))
+        :response-format :json}))
+
+(defn get-tracks []
+  (GET "http://localhost:8080/api/tracks"
+       {:handler #(update-state! :tracks (% "items"))
         :response-format :json}))
 
 ;; -------------------------

            [ajax.core :refer [GET POST]]))

(def state (r/atom {:server "http://localhost:8080"
                    :playlist []}))

(defn update-state! [k value]
  (swap! state assoc k value))

   [:ul (for [track (@state :playlist)]
          [:li (track-span track)])]])

(defn tracks-div []
  (js/setTimeout get-tracks 1000)
  [:div [:h2 "Tracks"]
   [:ul (for [track (@state :tracks)]
          [:li (track-span track)])]])

(defn home-page []
  [:div [:h1 "Airhead"]
   [server-form]
   [playlist-div]
   [tracks-div]])

;; -------------------------
;; Initialize app
