diff --git a/frontend/src/frontend/core.cljs b/frontend/src/frontend/core.cljs index 6c031dfbf..113dc3587 100644 --- a/frontend/src/frontend/core.cljs +++ b/frontend/src/frontend/core.cljs @@ -4,23 +4,27 @@ [frontend.page :as page] [frontend.routes :as routes] [reitit.frontend :as rf] - [reitit.frontend.easy :as rfe] - [reitit.coercion :as rc] - [reitit.coercion.spec :as rss])) + [reitit.frontend.easy :as rfe])) + +(defn set-router! + [] + (rfe/start! + (rf/router routes/routes {}) + handler/set-route-match! + ;; set to false to enable HistoryAPI + {:use-fragment false})) (defn start [] - (rum/mount (page/current-page) - (.getElementById js/document "root"))) + (rum/mount + (page/current-page) + (.getElementById js/document "root")) + (set-router!)) (defn ^:export init [] + (prn "init!") ;; init is called ONCE when the page loads ;; this is called in the index.html and must be exported ;; so it is available even in :advanced release builds - (rfe/start! - (rf/router routes/routes {:data {:coercion rss/coercion}}) - handler/set-route-match! - ;; set to false to enable HistoryAPI - {:use-fragment false}) ;; (handler/get-me) diff --git a/frontend/src/frontend/page.cljs b/frontend/src/frontend/page.cljs index 4248d4da7..b7183ae0d 100644 --- a/frontend/src/frontend/page.cljs +++ b/frontend/src/frontend/page.cljs @@ -6,6 +6,7 @@ [] (let [state (rum/react state/state) route-match (:route-match state)] + (prn "route: " route-match) (if route-match (when-let [view (:view (:data route-match))] (view route-match)))))