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 | 11 |
1 files changed, 9 insertions, 2 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 e30656b92..0c4e4b0d6 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 | |||
@@ -9,6 +9,7 @@ import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | |||
9 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 9 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
10 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 10 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
11 | import { VideoPlaylistType } from '@shared/models' | 11 | import { VideoPlaylistType } from '@shared/models' |
12 | import { Subject } from 'rxjs' | ||
12 | 13 | ||
13 | @Component({ | 14 | @Component({ |
14 | selector: 'my-account-video-playlists', | 15 | selector: 'my-account-video-playlists', |
@@ -20,10 +21,12 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { | |||
20 | 21 | ||
21 | pagination: ComponentPagination = { | 22 | pagination: ComponentPagination = { |
22 | currentPage: 1, | 23 | currentPage: 1, |
23 | itemsPerPage: 10, | 24 | itemsPerPage: 5, |
24 | totalItems: null | 25 | totalItems: null |
25 | } | 26 | } |
26 | 27 | ||
28 | onDataSubject = new Subject<any[]>() | ||
29 | |||
27 | private user: User | 30 | private user: User |
28 | 31 | ||
29 | constructor ( | 32 | constructor ( |
@@ -78,11 +81,15 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { | |||
78 | } | 81 | } |
79 | 82 | ||
80 | private loadVideoPlaylists () { | 83 | private loadVideoPlaylists () { |
84 | const playlistsObservable = this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt') | ||
85 | |||
81 | this.authService.userInformationLoaded | 86 | this.authService.userInformationLoaded |
82 | .pipe(flatMap(() => this.videoPlaylistService.listAccountPlaylists(this.user.account, '-updatedAt'))) | 87 | .pipe(flatMap(() => playlistsObservable)) |
83 | .subscribe(res => { | 88 | .subscribe(res => { |
84 | this.videoPlaylists = this.videoPlaylists.concat(res.data) | 89 | this.videoPlaylists = this.videoPlaylists.concat(res.data) |
85 | this.pagination.totalItems = res.total | 90 | this.pagination.totalItems = res.total |
91 | |||
92 | this.onDataSubject.next(res.data) | ||
86 | }) | 93 | }) |
87 | } | 94 | } |
88 | } | 95 | } |