]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/video-list/video-recently-added.component.ts
Rewrite infinite scroll
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-recently-added.component.ts
index 6168fac9512b0a13a7fae01f28717826d5119acc..f150e38dabe2b3369f37779977abc14bafa9b548 100644 (file)
@@ -1,6 +1,8 @@
 import { Component, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
+import { immutableAssign } from '@app/shared/misc/utils'
 import { NotificationsService } from 'angular2-notifications'
+import { AuthService } from '../../core/auth'
 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
 import { SortField } from '../../shared/video/sort-field.type'
 import { VideoService } from '../../shared/video/video.service'
@@ -18,6 +20,7 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
   constructor (protected router: Router,
                protected route: ActivatedRoute,
                protected notificationsService: NotificationsService,
+               protected authService: AuthService,
                private videoService: VideoService) {
     super()
   }
@@ -26,7 +29,9 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
     super.ngOnInit()
   }
 
-  getVideosObservable () {
-    return this.videoService.getVideos(this.pagination, this.sort)
+  getVideosObservable (page: number) {
+    const newPagination = immutableAssign(this.pagination, { currentPage: page })
+
+    return this.videoService.getVideos(newPagination, this.sort)
   }
 }