diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-25 15:43:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-25 15:43:19 +0200 |
commit | d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c (patch) | |
tree | 3c2406346c7774587ba4e095ab595e5953e25c61 /client/src/app/+account/account-video-channels/account-video-channels.component.ts | |
parent | 03e12d7c4954e1071fdeb7ef362ea5c3965d4075 (diff) | |
download | PeerTube-d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c.tar.gz PeerTube-d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c.tar.zst PeerTube-d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c.zip |
Add video channel account list
Diffstat (limited to 'client/src/app/+account/account-video-channels/account-video-channels.component.ts')
-rw-r--r-- | client/src/app/+account/account-video-channels/account-video-channels.component.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/client/src/app/+account/account-video-channels/account-video-channels.component.ts b/client/src/app/+account/account-video-channels/account-video-channels.component.ts new file mode 100644 index 000000000..8915eb622 --- /dev/null +++ b/client/src/app/+account/account-video-channels/account-video-channels.component.ts | |||
@@ -0,0 +1,33 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { ActivatedRoute } from '@angular/router' | ||
3 | import 'rxjs/add/observable/from' | ||
4 | import 'rxjs/add/operator/concatAll' | ||
5 | import { Account } from '@app/shared/account/account.model' | ||
6 | import { AccountService } from '@app/shared/account/account.service' | ||
7 | import { VideoChannel } from '../../../../../shared/models/videos' | ||
8 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | ||
9 | |||
10 | @Component({ | ||
11 | selector: 'my-account-video-channels', | ||
12 | templateUrl: './account-video-channels.component.html', | ||
13 | styleUrls: [ './account-video-channels.component.scss' ] | ||
14 | }) | ||
15 | export class AccountVideoChannelsComponent implements OnInit { | ||
16 | account: Account | ||
17 | videoChannels: VideoChannel[] = [] | ||
18 | |||
19 | constructor ( | ||
20 | protected route: ActivatedRoute, | ||
21 | private accountService: AccountService, | ||
22 | private videoChannelService: VideoChannelService | ||
23 | ) { } | ||
24 | |||
25 | ngOnInit () { | ||
26 | // Parent get the account for us | ||
27 | this.accountService.accountLoaded | ||
28 | .do(account => this.account = account) | ||
29 | .flatMap(account => this.videoChannelService.getVideoChannels(account.id)) | ||
30 | .map(res => res.data) | ||
31 | .subscribe(videoChannels => this.videoChannels = videoChannels) | ||
32 | } | ||
33 | } | ||