-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcore.cljs
31 lines (28 loc) · 1023 Bytes
/
core.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(ns front.app.routes.core
(:require
[goog.object :as gobj]
[refx.alpha :as refx]
[reitit.coercion.schema :as rsc]
[reitit.frontend :as rf]
[reitit.frontend.easy :as rfe]
[reitit.frontend.history :refer [ignore-anchor-click?]]))
(defn router [routes]
(rf/router
routes
{:data {:controllers [{:start (fn [ctx] (prn :ctx ctx))
:stop (fn [ctx] (prn :ctx ctx))}]
:coercion rsc/coercion
:public? false}}))
(defn on-navigate [new-match]
(when new-match
(refx/dispatch [:app.routes/navigated new-match])))
(defn init-routes! [routes]
(js/console.log "initializing routes")
(rfe/start!
(router routes)
on-navigate
{:use-fragment true
:ignore-anchor-click? (fn [router e el uri]
;; Add additional check on top of the default checks
(and (ignore-anchor-click? router e el uri)
(not= "false" (gobj/get (.-dataset el) "reititHandleClick"))))}))