diff options
Diffstat (limited to 'client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts')
-rw-r--r-- | client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts index 761ce90e8..e30656b92 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts | |||
@@ -69,17 +69,20 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { | |||
69 | return playlist.type.id === VideoPlaylistType.REGULAR | 69 | return playlist.type.id === VideoPlaylistType.REGULAR |
70 | } | 70 | } |
71 | 71 | ||
72 | private loadVideoPlaylists () { | 72 | onNearOfBottom () { |
73 | this.authService.userInformationLoaded | ||
74 | .pipe(flatMap(() => this.videoPlaylistService.listAccountPlaylists(this.user.account))) | ||
75 | .subscribe(res => this.videoPlaylists = res.data) | ||
76 | } | ||
77 | |||
78 | private ofNearOfBottom () { | ||
79 | // Last page | 73 | // Last page |
80 | if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return | 74 | if (this.pagination.totalItems <= (this.pagination.currentPage * this.pagination.itemsPerPage)) return |
81 | 75 | ||
82 | this.pagination.currentPage += 1 | 76 | this.pagination.currentPage += 1 |
83 | this.loadVideoPlaylists() | 77 | this.loadVideoPlaylists() |
84 | } | 78 | } |
79 | |||
80 | private loadVideoPlaylists () { | ||
81 | this.authService.userInformationLoaded | ||
82 | .pipe(flatMap(() => this.videoPlaylistService.listAccountPlaylists(this.user.account, '-updatedAt'))) | ||
83 | .subscribe(res => { | ||
84 | this.videoPlaylists = this.videoPlaylists.concat(res.data) | ||
85 | this.pagination.totalItems = res.total | ||
86 | }) | ||
87 | } | ||
85 | } | 88 | } |