       (for [item chunk-row]
         [chunk-card item])])])
 
+(defn nav-helper
+  "Creating the map so that links will be routed without server-refresh"
+  [token]
+  {:href token
+   :on-click #(do
+                (.preventDefault %)
+                (.setToken history token))})
+
 (defn header
   []
   [:nav.navbar.navbar-light.bg-faded
    [:div.container
-    [:a.navbar-brand {:href "#"} "bitfondue"]
+    [:a.navbar-brand (nav-helper "/") "bitfondue"]
     [:ul.nav.navbar-nav
      [:li.nav-item
-      [:a.nav-link {:href "#features"} "Features"]]
-     [:li.nav-item
-      [:a.nav-link {:href "#pricing"} "Pricing"]]
-     [:li.nav-item
-      [:a.nav-link {:href "#about"} "About"]]]
+      [:a.nav-link (nav-helper "/features") "Features"]]
+     [:li.nav-item
+      [:a.nav-link (nav-helper "/pricing") "Pricing"]]
+     [:li.nav-item
+      [:a.nav-link (nav-helper "/about") "About"]]]
     [:ul.nav.navbar-nav.pull-right
      [:li.nav-item
-      [:a.nav-link {:href "#login"} "Login"]]
-     [:li.nav-item
-      [:a.nav-link {:href "#register"} "Register"]]]]])
+      [:a.nav-link (nav-helper "/login") "Login"]]
+     [:li.nav-item
+      [:a.nav-link (nav-helper "/register") "Register"]]]]])
 
 (defn footer
   []

  (reagent/render-component
   [page-component]
   application))

;; set secretary to use # for the routing, eg. /#dashboard
(secretary/set-config! :prefix "#")

(defroute "/" [] (page home-anonymous))
(defroute "/dashboard" [] (page home-authenticated))

(defroute "/register" [] (page register))
(defroute "*" [] (page not-found))

;; init the html5-history support
(goog.events/listen history
                    EventType.NAVIGATE
                    #(handle-url-change %))
(.setEnabled history true)

;; load the data from the API
(fetch-chunks)
