mirror of
https://github.com/penpot/penpot.git
synced 2025-07-04 15:27:17 +02:00
Minor improvements on router ns.
This commit is contained in:
parent
48819a1738
commit
0c2ac8352c
1 changed files with 10 additions and 7 deletions
|
@ -55,17 +55,20 @@
|
||||||
;; --- Public Api
|
;; --- Public Api
|
||||||
|
|
||||||
(defn init
|
(defn init
|
||||||
[routes]
|
([routes]
|
||||||
(let [opts {:on-navigate #(rs/emit! (update-location %))
|
(init routes nil))
|
||||||
:default-location {:handler :auth/login}}
|
([routes {:keys [default] :or {default :auth/login}}]
|
||||||
router (bidi.router/start-router! routes opts)]
|
(let [opts {:on-navigate #(rs/emit! (update-location %))
|
||||||
(set! +routes+ routes)
|
:default-location {:handler default}}
|
||||||
(set! +router+ router)))
|
router (bidi.router/start-router! routes opts)]
|
||||||
|
(set! +routes+ routes)
|
||||||
|
(set! +router+ router))))
|
||||||
|
|
||||||
(defn go
|
(defn go
|
||||||
"Redirect the user to other url."
|
"Redirect the user to other url."
|
||||||
([id] (go id nil))
|
([id] (go id nil))
|
||||||
([id params] (rs/emit! (navigate id params))))
|
([id params]
|
||||||
|
(rs/emit! (navigate id params))))
|
||||||
|
|
||||||
(defn route-for
|
(defn route-for
|
||||||
"Given a location handler and optional parameter map, return the URI
|
"Given a location handler and optional parameter map, return the URI
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue