Files
integreat/src/cljs/auto_ap/history.cljs
2018-05-03 15:23:10 -07:00

16 lines
437 B
Clojure

(ns auto-ap.history
(:require [bidi.bidi :as bidi]
[pushy.core :as pushy]
[auto-ap.routes :as routes]
[re-frame.core :as re-frame]))
(defn- parse-url [url]
(bidi/match-route routes/routes url))
(defn- dispatch-route [matched-route]
(println matched-route)
(re-frame/dispatch [:auto-ap.events/set-active-page (:handler matched-route)]))
(def history (pushy/pushy dispatch-route parse-url))