aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/video')
-rw-r--r--client/src/app/shared/video/abstract-video-list.ts3
-rw-r--r--client/src/app/shared/video/video.service.ts11
2 files changed, 11 insertions, 3 deletions
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts
index a468d3231..d60536e20 100644
--- a/client/src/app/shared/video/abstract-video-list.ts
+++ b/client/src/app/shared/video/abstract-video-list.ts
@@ -24,6 +24,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
24 totalItems: null 24 totalItems: null
25 } 25 }
26 sort: VideoSortField = '-publishedAt' 26 sort: VideoSortField = '-publishedAt'
27 category?: number
27 defaultSort: VideoSortField = '-publishedAt' 28 defaultSort: VideoSortField = '-publishedAt'
28 syndicationItems = [] 29 syndicationItems = []
29 30
@@ -167,7 +168,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
167 168
168 protected loadRouteParams (routeParams: { [ key: string ]: any }) { 169 protected loadRouteParams (routeParams: { [ key: string ]: any }) {
169 this.sort = routeParams['sort'] as VideoSortField || this.defaultSort 170 this.sort = routeParams['sort'] as VideoSortField || this.defaultSort
170 171 this.category = routeParams['category']
171 if (routeParams['page'] !== undefined) { 172 if (routeParams['page'] !== undefined) {
172 this.pagination.currentPage = parseInt(routeParams['page'], 10) 173 this.pagination.currentPage = parseInt(routeParams['page'], 10)
173 } else { 174 } else {
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 2da36ff1b..4783adf42 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -158,7 +158,8 @@ export class VideoService {
158 getVideos ( 158 getVideos (
159 videoPagination: ComponentPagination, 159 videoPagination: ComponentPagination,
160 sort: VideoSortField, 160 sort: VideoSortField,
161 filter?: VideoFilter 161 filter?: VideoFilter,
162 category?: number
162 ): Observable<{ videos: Video[], totalVideos: number }> { 163 ): Observable<{ videos: Video[], totalVideos: number }> {
163 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 164 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
164 165
@@ -169,6 +170,10 @@ export class VideoService {
169 params = params.set('filter', filter) 170 params = params.set('filter', filter)
170 } 171 }
171 172
173 if (category) {
174 params = params.set('category', category + '')
175 }
176
172 return this.authHttp 177 return this.authHttp
173 .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params }) 178 .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params })
174 .pipe( 179 .pipe(
@@ -202,11 +207,13 @@ export class VideoService {
202 return feeds 207 return feeds
203 } 208 }
204 209
205 getVideoFeedUrls (sort: VideoSortField, filter?: VideoFilter) { 210 getVideoFeedUrls (sort: VideoSortField, filter?: VideoFilter, category?: number) {
206 let params = this.restService.addRestGetParams(new HttpParams(), undefined, sort) 211 let params = this.restService.addRestGetParams(new HttpParams(), undefined, sort)
207 212
208 if (filter) params = params.set('filter', filter) 213 if (filter) params = params.set('filter', filter)
209 214
215 if (category) params = params.set('category', category + '')
216
210 return this.buildBaseFeedUrls(params) 217 return this.buildBaseFeedUrls(params)
211 } 218 }
212 219