]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/recommendations/recent-videos-recommendation.service.ts
match margin of abstract-video-list and sub-menu's fixed margin
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / recommendations / recent-videos-recommendation.service.ts
index 6d7b159dad90e1cc13952a65f2979f690cbe2a4a..a1e65c27cddd99d93bd5cda764482b0fdffca53d 100644 (file)
@@ -32,21 +32,25 @@ export class RecentVideosRecommendationService implements RecommendationService
 
   private fetchPage (page: number, recommendation: RecommendationInfo): Observable<Video[]> {
     const pagination = { currentPage: page, itemsPerPage: this.pageSize + 1 }
-    const defaultSubscription = this.videos.getVideos(pagination, '-createdAt')
-                                    .pipe(map(v => v.videos))
+    const defaultSubscription = this.videos.getVideos({ videoPagination: pagination, sort: '-createdAt' })
+                                    .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)
+                 })
+               )
   }
 }