aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-07 11:19:26 +0200
committerChocobozzz <me@florianbigard.com>2018-06-07 11:19:26 +0200
commit734a5ceb3d04088743d72babcb9b05e6142043f6 (patch)
tree965bfbd0bf930cf4cc9568a5dc801c4e3909a1b4 /client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
parentcc69c8db39f48b1053c246458541ccc406228711 (diff)
downloadPeerTube-734a5ceb3d04088743d72babcb9b05e6142043f6.tar.gz
PeerTube-734a5ceb3d04088743d72babcb9b05e6142043f6.tar.zst
PeerTube-734a5ceb3d04088743d72babcb9b05e6142043f6.zip
Fix account/channel pages route subscription
Diffstat (limited to 'client/src/app/+accounts/account-video-channels/account-video-channels.component.ts')
-rw-r--r--client/src/app/+accounts/account-video-channels/account-video-channels.component.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
index a6e6dd656..ebc671113 100644
--- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
+++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts
@@ -1,20 +1,23 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute } from '@angular/router' 2import { ActivatedRoute } from '@angular/router'
3import { Account } from '@app/shared/account/account.model' 3import { Account } from '@app/shared/account/account.model'
4import { AccountService } from '@app/shared/account/account.service' 4import { AccountService } from '@app/shared/account/account.service'
5import { VideoChannel } from '../../../../../shared/models/videos' 5import { VideoChannel } from '../../../../../shared/models/videos'
6import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' 6import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
7import { flatMap, map, tap } from 'rxjs/operators' 7import { flatMap, map, tap } from 'rxjs/operators'
8import { Subscription } from 'rxjs'
8 9
9@Component({ 10@Component({
10 selector: 'my-account-video-channels', 11 selector: 'my-account-video-channels',
11 templateUrl: './account-video-channels.component.html', 12 templateUrl: './account-video-channels.component.html',
12 styleUrls: [ './account-video-channels.component.scss' ] 13 styleUrls: [ './account-video-channels.component.scss' ]
13}) 14})
14export class AccountVideoChannelsComponent implements OnInit { 15export class AccountVideoChannelsComponent implements OnInit, OnDestroy {
15 account: Account 16 account: Account
16 videoChannels: VideoChannel[] = [] 17 videoChannels: VideoChannel[] = []
17 18
19 private accountSub: Subscription
20
18 constructor ( 21 constructor (
19 protected route: ActivatedRoute, 22 protected route: ActivatedRoute,
20 private accountService: AccountService, 23 private accountService: AccountService,
@@ -23,7 +26,7 @@ export class AccountVideoChannelsComponent implements OnInit {
23 26
24 ngOnInit () { 27 ngOnInit () {
25 // Parent get the account for us 28 // Parent get the account for us
26 this.accountService.accountLoaded 29 this.accountSub = this.accountService.accountLoaded
27 .pipe( 30 .pipe(
28 tap(account => this.account = account), 31 tap(account => this.account = account),
29 flatMap(account => this.videoChannelService.listAccountVideoChannels(account)), 32 flatMap(account => this.videoChannelService.listAccountVideoChannels(account)),
@@ -31,4 +34,8 @@ export class AccountVideoChannelsComponent implements OnInit {
31 ) 34 )
32 .subscribe(videoChannels => this.videoChannels = videoChannels) 35 .subscribe(videoChannels => this.videoChannels = videoChannels)
33 } 36 }
37
38 ngOnDestroy () {
39 if (this.accountSub) this.accountSub.unsubscribe()
40 }
34} 41}