diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2022-12-26 22:02:33 +0100 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2022-12-26 22:02:33 +0100 |
commit | b5404ac06a3a09d83bef66552083254fdff12196 (patch) | |
tree | 02785ab11a3dcf328e8d1375a7b76abb2edbf382 /src/frontend/tau/routes.cljs | |
parent | dce9e36b352509665887ea1ca2e6f81904038a11 (diff) |
feat(frontend): Modularize components and add pagination
Diffstat (limited to 'src/frontend/tau/routes.cljs')
-rw-r--r-- | src/frontend/tau/routes.cljs | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/frontend/tau/routes.cljs b/src/frontend/tau/routes.cljs index 1742aaa..af309c9 100644 --- a/src/frontend/tau/routes.cljs +++ b/src/frontend/tau/routes.cljs @@ -4,7 +4,11 @@ [reitit.frontend.easy :as rfe] [reitit.frontend.controllers :as rfc] [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] [tau.views.stream :as stream])) @@ -16,14 +20,33 @@ :name ::search :controllers [{:parameters {:query [:q :serviceId]} :start (fn [parameters] - (rf/dispatch [:get-search-results - {:id (-> parameters :query :serviceId) + (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)}]))}]}] ["/stream" {:view stream/stream :name ::stream :controllers [{:parameters {:query [:url]} :start (fn [parameters] - (rf/dispatch [:get-stream (-> parameters :query :url)]))}]}]])) + (rf/dispatch [::events/get-stream (-> parameters :query :url)]))}]}] + ["/channel" {:view channel/channel + :name ::channel + :controllers [{:parameters {:query [:url]} + :start (fn [parameters] + (rf/dispatch [::events/get-channel (-> parameters :query :url)]))}]}] + ["/playlist" {:view playlist/playlist + :name ::playlist + :controllers [{:parameters {:query [:url]} + :start (fn [parameters] + (rf/dispatch [::events/get-playlist (-> parameters :query :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)}]))}]}]])) (defn on-navigate [new-match] @@ -31,7 +54,7 @@ (when new-match (let [controllers (rfc/apply-controllers (:controllers @old-match) new-match) match (assoc new-match :controllers controllers)] - (rf/dispatch [:navigated match]))))) + (rf/dispatch [::events/navigated match]))))) (defn start-routes! [] |