aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/search/search.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/search/search.component.ts')
-rw-r--r--client/src/app/search/search.component.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts
index f88df6391..ed84e24d9 100644
--- a/client/src/app/search/search.component.ts
+++ b/client/src/app/search/search.component.ts
@@ -87,9 +87,17 @@ export class SearchComponent implements OnInit, OnDestroy {
87 .subscribe( 87 .subscribe(
88 ([ videosResult, videoChannelsResult ]) => { 88 ([ videosResult, videoChannelsResult ]) => {
89 this.videos = this.videos.concat(videosResult.videos) 89 this.videos = this.videos.concat(videosResult.videos)
90 this.pagination.totalItems = videosResult.totalVideos 90 this.pagination.totalItems = videosResult.totalVideos + videoChannelsResult.total
91 91
92 this.videoChannels = videoChannelsResult.data 92 this.videoChannels = this.videoChannels.concat(videoChannelsResult.data)
93
94 // Focus on channels
95 if (this.channelsPerPage !== 10 && this.videos.length < this.pagination.itemsPerPage) {
96 this.resetPagination()
97
98 this.channelsPerPage = 10
99 this.search()
100 }
93 }, 101 },
94 102
95 error => { 103 error => {
@@ -116,8 +124,10 @@ export class SearchComponent implements OnInit, OnDestroy {
116 private resetPagination () { 124 private resetPagination () {
117 this.pagination.currentPage = 1 125 this.pagination.currentPage = 1
118 this.pagination.totalItems = null 126 this.pagination.totalItems = null
127 this.channelsPerPage = 2
119 128
120 this.videos = [] 129 this.videos = []
130 this.videoChannels = []
121 } 131 }
122 132
123 private updateTitle () { 133 private updateTitle () {