aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/tubo
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/tubo')
-rw-r--r--src/frontend/tubo/events.cljs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/frontend/tubo/events.cljs b/src/frontend/tubo/events.cljs
index 5aecfec..c237b1c 100644
--- a/src/frontend/tubo/events.cljs
+++ b/src/frontend/tubo/events.cljs
@@ -354,12 +354,16 @@
(rf/reg-event-db
::load-paginated-search-results
(fn [db [_ res]]
- (-> db
- (update-in [:search-results :items] #(apply conj %1 %2)
- (:items (js->clj res :keywordize-keys true)))
- (assoc-in [:search-results :next-page]
- (:next-page (js->clj res :keywordize-keys true)))
- (assoc :show-pagination-loading false))))
+ (let [search-res (js->clj res :keywordize-keys true)]
+ (if (empty? (:items search-res))
+ (-> db
+ (assoc-in [:search-results :next-page] nil)
+ (assoc :show-pagination-loading false))
+ (-> db
+ (update-in [:search-results :items] #(apply conj %1 %2)
+ (:items search-res))
+ (assoc-in [:search-results :next-page] (:next-page search-res))
+ (assoc :show-pagination-loading false))))))
(rf/reg-event-fx
::search-pagination