 (defn main
   []
   (secretary/set-config! :prefix "#")
-  (set-key-value :page-location [login])
+  (set-key-value :page-location [render-documents []])
   (r/render [page]
             (.getElementById js/document "app1"))
   (let [history (History.)]

         [button "Sign-in" "button" my-data focus ]]]])))

(defn set-page! [currnt-page]
  (if (nil? (get-value! :user))(set-key-value :page-location
                                              [login])
      (set-key-value :page-location
                     currnt-page)))

(defn is-authenticated? []
  (not (nil? (get-value! :user))))

  (set-page! (get-value! :page-location)))

(defroute documents-list "/documents" []
  (let [onres (fn [json]
                (let [dt (getdata json)]
                  (set-key-value :documents dt)
                  (set-key-value :total-pages (get-total-rec-no dt))
                  (set-key-value :page-location  [render-documents (get-new-page-data (get-value! :documents)
                                                                                      (get-value! :current-page))])))]
    (http-get "http://localhost:8193/documents/all" onres)))


(defroute documents-path "/documents/add" []
