 (ns todo-clj.core
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
-            [ajax.core :refer [GET POST]]))
+            [ajax.core :refer [GET POST DELETE]]))
 
 (enable-console-print!)
 

                        :placeholder "What needs to be done?"
                        :onKeyPress #(handle-key-press % app owner)}
                   nil)
        (dom/ul nil (map todo (get app :todos)))))))

(om/root
 root-component

(defn handler [response cursor]
  (om/update! cursor :todos response))


(defn remove-todo [todo]
  (let [url (:url todo)]
    (DELETE url {:handler trace
                 :error-handler trace
                 :format :json})))

(defn todo-view [todo]
  (reify
    om/IRender
    (render [_]
      (dom/li #js {:key (str (:id todo) (rand)) :className "todo"}
              (:title todo)
              (dom/button #js {:className "todo__remove" :onClick #(remove-todo todo)} "x")))))

(defn add-todo [app owner]
  (let [title (.-value (om/get-node owner "new-todo"))]    
