Polish example

This commit is contained in:
Tommi Reiman 2018-12-17 20:54:36 +02:00
parent 56ad6a5168
commit 0b9c72ab0f

View file

@ -52,24 +52,25 @@
[:pre (with-out-str (fedn/pprint @match))]]) [:pre (with-out-str (fedn/pprint @match))]])
(def routes (def routes
(rf/router [["/"
["/"
[""
{:name ::frontpage {:name ::frontpage
:view home-page}] :view home-page}]
["about"
["/about"
{:name ::about {:name ::about
:view about-page}] :view about-page}]
["item/:id"
["/item/:id"
{:name ::item {:name ::item
:view item-page :view item-page
:parameters {:path {:id s/Int} :parameters {:path {:id s/Int}
:query {(s/optional-key :foo) s/Keyword}}}]] :query {(s/optional-key :foo) s/Keyword}}}]])
{:data {:coercion rsc/coercion}}))
(defn init! [] (defn init! []
(rfe/start! routes (rfe/start!
(rf/router routes {:data {:coercion rsc/coercion}})
(fn [m] (reset! match m)) (fn [m] (reset! match m))
;; set to false to enable HistoryAPI
{:use-fragment true}) {:use-fragment true})
(r/render [current-page] (.getElementById js/document "app"))) (r/render [current-page] (.getElementById js/document "app")))