mirror of
https://github.com/metosin/reitit.git
synced 2025-12-18 08:51:12 +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
|
(def routes
|
||||||
(rc/router
|
(rc/router
|
||||||
[""
|
["/"
|
||||||
[""
|
[""
|
||||||
{:name ::frontpage-root
|
{:name ::frontpage
|
||||||
:view home-page}]
|
:view home-page}]
|
||||||
["/"
|
["about"
|
||||||
[""
|
{:name ::about
|
||||||
{:name ::frontpage
|
:view about-page}]]))
|
||||||
:view home-page}]
|
|
||||||
["about"
|
|
||||||
{:name ::about
|
|
||||||
:view about-page}]]]))
|
|
||||||
|
|
||||||
(defn init! []
|
(defn init! []
|
||||||
(reset! router (rfh/start! routes
|
(reset! router (rfh/start! routes
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@
|
||||||
|
|
||||||
(defn- token->path [history token]
|
(defn- token->path [history token]
|
||||||
(if (.-useFragment_ history)
|
(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)))
|
(str (.getPathPrefix history) token)))
|
||||||
|
|
||||||
(defn- path->token [history path]
|
(defn- path->token [history path]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue