0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 00:40:30 -05:00

Minor improvements on router ns.

This commit is contained in:
Andrey Antukh 2016-07-09 15:05:06 +03:00
parent 48819a1738
commit 0c2ac8352c
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -55,17 +55,20 @@
;; --- Public Api
(defn init
[routes]
(let [opts {:on-navigate #(rs/emit! (update-location %))
:default-location {:handler :auth/login}}
router (bidi.router/start-router! routes opts)]
(set! +routes+ routes)
(set! +router+ router)))
([routes]
(init routes nil))
([routes {:keys [default] :or {default :auth/login}}]
(let [opts {:on-navigate #(rs/emit! (update-location %))
:default-location {:handler default}}
router (bidi.router/start-router! routes opts)]
(set! +routes+ routes)
(set! +router+ router))))
(defn go
"Redirect the user to other url."
([id] (go id nil))
([id params] (rs/emit! (navigate id params))))
([id params]
(rs/emit! (navigate id params))))
(defn route-for
"Given a location handler and optional parameter map, return the URI