aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/tau/routes.cljs
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/tau/routes.cljs')
-rw-r--r--src/frontend/tau/routes.cljs39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/frontend/tau/routes.cljs b/src/frontend/tau/routes.cljs
index af309c9..8cb2beb 100644
--- a/src/frontend/tau/routes.cljs
+++ b/src/frontend/tau/routes.cljs
@@ -6,7 +6,6 @@
[re-frame.core :as rf]
[tau.events :as events]
[tau.views.channel :as channel]
- [tau.views.home :as home]
[tau.views.kiosk :as kiosk]
[tau.views.playlist :as playlist]
[tau.views.search :as search]
@@ -14,43 +13,45 @@
(def routes
(ref/router
- [["/" {:view home/home-page
- :name ::home}]
+ [["/" {:view kiosk/kiosk
+ :name ::home
+ :controllers [{:start (fn [_]
+ (rf/dispatch [::events/change-service-id 0])
+ (rf/dispatch [::events/get-default-kiosk 0])
+ (rf/dispatch [::events/get-kiosks 0]))}]}]
["/search" {:view search/search
:name ::search
:controllers [{:parameters {:query [:q :serviceId]}
- :start (fn [parameters]
- (rf/dispatch [::events/change-service-id
- (js/parseInt (-> parameters :query :serviceId))])
- (rf/dispatch [::events/get-search-results
- {:service-id (-> parameters :query :serviceId)
- :query (-> parameters :query :q)}]))}]}]
+ :start (fn [{{:keys [serviceId q]} :query}]
+ (rf/dispatch [::events/change-service-id (js/parseInt serviceId)])
+ (rf/dispatch [::events/get-search-results serviceId q]))}]}]
["/stream" {:view stream/stream
:name ::stream
:controllers [{:parameters {:query [:url]}
- :start (fn [parameters]
- (rf/dispatch [::events/get-stream (-> parameters :query :url)]))}]}]
+ :start (fn [{{:keys [url]} :query}]
+ (rf/dispatch [::events/get-stream url]))}]}]
["/channel" {:view channel/channel
:name ::channel
:controllers [{:parameters {:query [:url]}
- :start (fn [parameters]
- (rf/dispatch [::events/get-channel (-> parameters :query :url)]))}]}]
+ :start (fn [{{:keys [url]} :query}]
+ (rf/dispatch [::events/get-channel url]))}]}]
["/playlist" {:view playlist/playlist
:name ::playlist
:controllers [{:parameters {:query [:url]}
- :start (fn [parameters]
- (rf/dispatch [::events/get-playlist (-> parameters :query :url)]))}]}]
+ :start (fn [{{:keys [url]} :query}]
+ (rf/dispatch [::events/get-playlist url]))}]}]
["/kiosk" {:view kiosk/kiosk
:name ::kiosk
:controllers [{:parameters {:query [:kioskId :serviceId]}
- :start (fn [parameters]
- (rf/dispatch [::events/get-kiosk
- {:service-id (-> parameters :query :serviceId)
- :kiosk-id (-> parameters :query :kioskId)}]))}]}]]))
+ :start (fn [{{:keys [serviceId kioskId]} :query}]
+ (rf/dispatch [::events/change-service-id (js/parseInt serviceId)])
+ (rf/dispatch [::events/get-kiosk serviceId kioskId])
+ (rf/dispatch [::events/get-kiosks serviceId]))}]}]]))
(defn on-navigate
[new-match]
(let [old-match (rf/subscribe [:current-match])]
+ (rf/dispatch [::events/reset-page-scroll])
(when new-match
(let [controllers (rfc/apply-controllers (:controllers @old-match) new-match)
match (assoc new-match :controllers controllers)]