(ns comic-reader.routes
  (:require [comic-reader.history :as h]
            [re-frame.core :as rf]
            [secretary.core :as secretary
             :refer-macros [defroute]]))

;; Have secretary pull apart URL's and then dispatch with re-frame
(defroute sites-path "/" []
  (rf/dispatch [:sites]))

(defroute comics-path "/comics/:site" {:keys [site]
                                       {:keys [filter]}
                                       :query-params}
  (rf/dispatch [:comics site filter]))

(defroute read-path "/read/:site/:comic/:chapter/:page"
  {site :site
   :as location}
  (let [location (dissoc location :site)]
    (rf/dispatch [:read site location])))

(defroute "*" {:as _}
  (rf/dispatch [:unknown]))

(defn go-to [page]
  (h/set-token page))

(defn setup-secretary! []
  (secretary/set-config! :prefix "#"))

(ns comic-reader.routes
  (:require [comic-reader.history :as h]
            [re-frame.core :as rf]
            [secretary.core :as secretary
             :refer-macros [defroute]]))

;; Have secretary pull apart URL's and then dispatch with re-frame
(defroute sites-path "/" []
  (rf/dispatch [:sites]))

(defroute comics-path "/comics/:site" {:keys [site]
                                       {:keys [filter]}
                                       :query-params}
  (rf/dispatch [:comics site filter]))

(defroute read-path "/read/:site/:comic/:chapter/:page"
  {site :site
   :as location}
  (let [location (dissoc location :site)]
    (rf/dispatch [:read site location])))

(defroute "*" {:as _}
  (rf/dispatch [:unknown]))

(defn go-to [page]
  (h/set-token page))

(defn setup-secretary! []
  (secretary/set-config! :prefix "/#"))

Make secretary use a rooted prefix
Make secretary use a rooted prefix

No more double octothorpes!!

RadicalZephyr/comic-reader,RadicalZephyr/comic-reader