mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 00:11:11 +00:00
Fix empty fragment url
This commit is contained in:
parent
50faacab25
commit
61a9871ebb
2 changed files with 10 additions and 10 deletions
|
|
@ -28,17 +28,13 @@
|
|||
|
||||
(def routes
|
||||
(rc/router
|
||||
[""
|
||||
["/"
|
||||
[""
|
||||
{:name ::frontpage-root
|
||||
{:name ::frontpage
|
||||
:view home-page}]
|
||||
["/"
|
||||
[""
|
||||
{:name ::frontpage
|
||||
:view home-page}]
|
||||
["about"
|
||||
{:name ::about
|
||||
:view about-page}]]]))
|
||||
["about"
|
||||
{:name ::about
|
||||
:view about-page}]]))
|
||||
|
||||
(defn init! []
|
||||
(reset! router (rfh/start! routes
|
||||
|
|
|
|||
|
|
@ -13,7 +13,11 @@
|
|||
|
||||
(defn- token->path [history token]
|
||||
(if (.-useFragment_ history)
|
||||
token
|
||||
;; If no fragment at all, default to "/"
|
||||
;; If fragment is present, the token already is prefixed with "/"
|
||||
(if (= "" token)
|
||||
(.getPathPrefix history)
|
||||
token)
|
||||
(str (.getPathPrefix history) token)))
|
||||
|
||||
(defn- path->token [history path]
|
||||
|
|
|
|||
Loading…
Reference in a new issue