   "Data request error handler"
   (.log js/console (str "something went wrong: " status " " status-text)))
 
-
 (defn fetch [url]
   "Get data from URL"
   (GET url {:handler handler

      (println "initial param was:" par)))
  (if (not (:data db nil))
    (do (println "Calling major Tom")
        (data_from_db "/data.json"))))

(defn viewer [c]
  (m "div" nil
     [(m "h1" {:style {:color "green"}} (:var db))
      (editor (:editing db))
      (m "div" {} [(m "ol" nil (notes (:data db) (:start db)))])
      (pages)]))

           (println "Fetched data from DB")
           (let [data (.parse js/JSON resp)]
           (updatedb [:data] (js->clj data))))))

(defn data_to_db [url]
  "Send data to db"
  (.write js/crud url (.stringify js/JSON (clj->js (:data db)))))

(defn setpage [next]
  (updatedb [:start] next))
