   (:import goog.History
            goog.json.Serializer))
 
+(def storage (r/atom {:documents {}
+                      :current-page 1
+                      :total-pages 1
+                      :document {}}))
+
 (def documents (r/atom nil))
 
 (def document (r/atom {}))
+
+(defn set-key-value [k v]
+  (reset! storage (assoc @storage k v)))
+
+(defn get-value! [k]
+  (k @storage))
 
 (defn get-total-rec-no [nos]
   (let [totrec (quot nos 10)]

      totrec
      (+ 1 totrec))))

(defn url-format [url title]
  [:a {:href url :class "btn btn-primary  glyphicon glyphicon-plus"} title])



(defn delete[id]
  (let [onres (fn [json]
                ((set-key-value :documents (getdata json))
                 (r/render [render-documents (get-new-page-data (get-value! :documents)
                                                                (get-value! :current-page))]
                           (.getElementById js/document "app1"))))]
    (http-delete (str "http://localhost:8193/documents/delete/" id)  onres)))

