 
 (def app-state (atom {:decks []}))
 
+(def select-channel (chan))
+
+(defn load-decks [decks]
+  (swap! app-state assoc :decks decks)
+  (put! select-channel (first (sort-by :date > decks))))
+
 (defn process-decks [decks]
   (for [deck decks]
     (let [cards (map #(str (:qty %) " " (:card %)) (:cards deck))]


(go (let [cards (<! cards-channel)
          decks (process-decks (:json (<! (GET (str "/data/decks")))))]
      (swap! app-state assoc :decks decks)
      (go (let [data (<! auth-channel)]
            (swap! app-state assoc :decks (process-decks (:decks data)))))
      (>! cards-channel cards)))

(defn side-identities [side]

                                      (<= new-qty 0) rest
                                      :else (conj rest {:qty new-qty :card card}))]
                  (om/set-state! owner [:deck :cards] new-cards))
                (deck->str owner)))))
      (go (while true
            (om/set-state! owner :deck (<! select-channel)))))

    om/IRenderState
    (render-state [this state]
