            (load-data comm)
            (while true
             (let [ [t value] (<! comm)]
-              (handle-event t app value))))))
+              (handle-comm-event t app value))))))
 
     om/IRenderState
     (render-state [_ {:keys [comm]}]


;;main component

(defn handler [f res]
  (f res))

(defn load-data [comm]
  (GET "http://localhost:3000/comments"
    {:response-format :json
     :keywords? true
     :handler (partial handler #(put! comm [:init %] ))
     :error-handler error-handler}))

;;put! comm [:add {:author "ar" :text "tr"}]
;;#(put! comm [:add {:author "ra" :text "rt"}])

(defn render-comment-list [{:keys [comments]}]
  (apply dom/ul #js {:className "commentList"}
    (om/build-all comment-view comments)))

(defn handle-event [t app val]
  (case t
    :add (om/transact! app :comments #(conj % val))
    :init (om/update! app {:comments val})
    nil))

(defn comment-box [app owner]
    (reify

  (atom
    {:comments [] }))

;;ajax

(defn simple-handler [response]
  (.log js/console (str response)))

(defn get-comments [f res]
  (f res))

(defn error-handler [{:keys [status status-text]}]
  (.log js/console (str "something bad happened: " status " " status-text)))

(defn load-data [comm]
  (GET "http://localhost:3000/comments"
    {:response-format :json
     :keywords? true
     :handler (partial get-comments #(put! comm [:init %] ))
     :error-handler error-handler}))

(defn save-commemnt [new-comment]
  (POST "http://localhost:3000/comments"
