X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Baccounts%2Faccount-video-channels%2Faccount-video-channels.component.ts;h=44f5626bb810f3961329285190cc059fb49a2ed3;hb=f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d;hp=a6e6dd656bbf73ccbbce65efee233e67eb8d6fff;hpb=ad9e39fb815d85e5e718c40540fa75471474fa17;p=github%2FChocobozzz%2FPeerTube.git 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..44f5626bb 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 @@ -import { Component, OnInit } from '@angular/core' +import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute } from '@angular/router' import { Account } from '@app/shared/account/account.model' import { AccountService } from '@app/shared/account/account.service' -import { VideoChannel } from '../../../../../shared/models/videos' import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' import { flatMap, map, tap } from 'rxjs/operators' +import { Subscription } from 'rxjs' +import { VideoChannel } from '@app/shared/video-channel/video-channel.model' @Component({ selector: 'my-account-video-channels', templateUrl: './account-video-channels.component.html', styleUrls: [ './account-video-channels.component.scss' ] }) -export class AccountVideoChannelsComponent implements OnInit { +export class AccountVideoChannelsComponent implements OnInit, OnDestroy { account: Account videoChannels: VideoChannel[] = [] + private accountSub: Subscription + constructor ( protected route: ActivatedRoute, private accountService: AccountService, @@ -23,7 +26,7 @@ export class AccountVideoChannelsComponent implements OnInit { ngOnInit () { // Parent get the account for us - this.accountService.accountLoaded + this.accountSub = this.accountService.accountLoaded .pipe( tap(account => this.account = account), flatMap(account => this.videoChannelService.listAccountVideoChannels(account)), @@ -31,4 +34,8 @@ export class AccountVideoChannelsComponent implements OnInit { ) .subscribe(videoChannels => this.videoChannels = videoChannels) } + + ngOnDestroy () { + if (this.accountSub) this.accountSub.unsubscribe() + } }