private fetchPage (page: number, recommendation: RecommendationInfo): Observable<Video[]> {
const pagination = { currentPage: page, itemsPerPage: this.pageSize + 1 }
const defaultSubscription = this.videos.getVideos({ videoPagination: pagination, sort: '-createdAt' })
- .pipe(map(v => v.videos))
+ .pipe(map(v => v.data))
if (!recommendation.tags || recommendation.tags.length === 0) return defaultSubscription
- return this.searchService.searchVideos('',
- pagination,
- new AdvancedSearch({ tagsOneOf: recommendation.tags.join(','), sort: '-createdAt' })
- ).pipe(
- map(v => v.videos),
- switchMap(videos => {
- if (videos.length <= 1) return defaultSubscription
-
- return of(videos)
- })
- )
+ const params = {
+ search: '',
+ componentPagination: pagination,
+ advancedSearch: new AdvancedSearch({ tagsOneOf: recommendation.tags.join(','), sort: '-createdAt' })
+ }
+
+ return this.searchService.searchVideos(params)
+ .pipe(
+ map(v => v.data),
+ switchMap(videos => {
+ if (videos.length <= 1) return defaultSubscription
+
+ return of(videos)
+ })
+ )
}
}