This commit is contained in:
Andrey Antukh 2015-12-13 13:04:34 +02:00
parent 113f5fcd16
commit 68b5f9c2ea
6 changed files with 291 additions and 24 deletions

View file

@ -14,10 +14,17 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn update-location
[{:keys [handler route-params]}]
[{:keys [handler route-params] :as params}]
(reify
IPrintWithWriter
(-pr-writer [mv writer x]
(-write writer "#<event:router/update-location ")
(-pr-writer params writer x)
(-write writer ">"))
rs/UpdateEvent
(-apply-update [_ state]
(println "-apply-update" handler route-params)
(merge state
{:location handler}
(when route-params
@ -28,6 +35,10 @@
([name params]
{:pre [(keyword? name)]}
(reify
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:router/navigate>"))
rs/EffectEvent
(-apply-effect [_ state]
(let [loc (merge {:handler name}
@ -60,7 +71,7 @@
(defonce +router+
(bidi.router/start-router! routes {:on-navigate on-navigate
:default-location {:handler :login}}))
:default-location {:handler :auth/login}}))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Public Api
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;