Skip to content
Permalink
fe8b587a61
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
25 lines (19 sloc) 804 Bytes
(ns ulysses.routes
(:require [re-frame.core :as re-frame :refer [dispatch]]
[bidi.bidi :as bidi]
[pushy.core :as pushy]))
;; ----------------------------------------------------------------------------
;; Routes
;; ----------------------------------------------------------------------------
(def routes ["/" {"" :home
["builder/" :grant-op-id] :builder
["profile/" :person-id] :profile
true :not-found}])
(defn- parse-url [url]
(bidi/match-route routes url))
(defn- dispatch-route [{:keys [handler route-params]}]
(dispatch [:set-active-page handler route-params]))
(defn app-routes []
(pushy/start! (pushy/pushy dispatch-route parse-url)))
(defn url-for [& args]
(apply (partial bidi/path-for routes) args))