 (defn set-app-state-field [field value]
   (swap! app-state update-in [field] #(str value))
   value)
-
-(defn loggedin-html []
-  [:p {:class "navbar-text navbar-right"} "Logged in as " (:username @app-state)])
 
 (defn error-html []
   [:div {:class "alert alert-danger" :role "alert"}

            :on-click (fn [] (alandipert.storage-atom/remove-local-storage! :saved-for-reddit-app-state)
                        (set! (.-location js/window) "/"))}]])

(defn post-html [p]
  (let [link? (nil? (:title p))
        title (unescapeEntities (if link? (:link_title p) (:title p)))
        url (if link? (str (:link_url p) (:key p)) (:url p))
        body (if (not (nil? (:body_html p))) (unescapeEntities (:body_html p)))
        subreddit (:subreddit p)
        author (:author p)


;; define your app data so that it doesn't get over-written on reload
(def app-state (local-storage (r/atom {:username ""
                                       :token ""
                                       :after ""})
                              :saved-for-reddit-app-state))

(def saved-posts (r/atom []))
