aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2024-12-19 22:40:04 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2024-12-19 22:40:04 +0100
commit8c282d4d24c156914390a87430d89fc5f2ac8ea8 (patch)
treecbc1f0720f61799daa02c8d276fd86248f974051 /src
parent6e0c07502ddba0817478b0ba29d768bc1dedf1e4 (diff)
fix: fix start radio event effect handler
Diffstat (limited to 'src')
-rw-r--r--src/frontend/tubo/bg_player/events.cljs25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/frontend/tubo/bg_player/events.cljs b/src/frontend/tubo/bg_player/events.cljs
index e7dcce8..da871d9 100644
--- a/src/frontend/tubo/bg_player/events.cljs
+++ b/src/frontend/tubo/bg_player/events.cljs
@@ -88,23 +88,22 @@
:bg-player/show
[(rf/inject-cofx :store)]
(fn [{:keys [db]} [_ stream notify?]]
- (let [updated-db (update db :queue conj stream)
- idx (.indexOf (:queue updated-db) stream)]
- {:fx [(if (= (count (:queue db)) 0)
- [:dispatch [:bg-player/fetch-stream (:url stream) idx true]]
- [:dispatch [:queue/add stream notify?]])]})))
+ {:fx [(if (= (count (:queue db)) 0)
+ [:dispatch [:bg-player/fetch-stream (:url stream) 0 true]]
+ [:dispatch [:queue/add stream notify?]])]}))
(rf/reg-event-fx
:bg-player/start-radio
(fn [{:keys [db]} [_ stream]]
- {:fx [[:dispatch [:bg-player/show stream]]
- (when (not= (count (:queue db)) 0)
- [:dispatch [:queue/change-pos (count (:queue db))]])
- [:dispatch [:bg-player/fetch-related-streams (:url stream)]]
- [:dispatch
- [:notifications/add
- {:status-text "Started stream radio"
- :failure :info}]]]}))
+ (let [updated-db (update db :queue conj stream)
+ idx (.lastIndexOf (:queue updated-db) stream)]
+ {:fx [[:dispatch [:queue/add stream]]
+ [:dispatch [:bg-player/fetch-stream (:url stream) idx true]]
+ [:dispatch [:bg-player/fetch-related-streams (:url stream)]]
+ [:dispatch
+ [:notifications/add
+ {:status-text "Started stream radio"
+ :failure :info}]]]})))
(rf/reg-event-fx
:bg-player/switch-to-main