From 734a5ceb3d04088743d72babcb9b05e6142043f6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 7 Jun 2018 11:19:26 +0200 Subject: Fix account/channel pages route subscription --- .../app/+accounts/account-videos/account-videos.component.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'client/src/app/+accounts/account-videos') diff --git a/client/src/app/+accounts/account-videos/account-videos.component.ts b/client/src/app/+accounts/account-videos/account-videos.component.ts index 476f04024..5e3dbb6b3 100644 --- a/client/src/app/+accounts/account-videos/account-videos.component.ts +++ b/client/src/app/+accounts/account-videos/account-videos.component.ts @@ -11,6 +11,7 @@ import { Account } from '@app/shared/account/account.model' import { AccountService } from '@app/shared/account/account.service' import { tap } from 'rxjs/operators' import { I18n } from '@ngx-translate/i18n-polyfill' +import { Subscription } from 'rxjs' @Component({ selector: 'my-account-videos', @@ -27,6 +28,7 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit, loadOnInit = false private account: Account + private accountSub: Subscription constructor ( protected router: Router, @@ -48,17 +50,19 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit, super.ngOnInit() // Parent get the account for us - this.accountService.accountLoaded + this.accountSub = this.accountService.accountLoaded .subscribe(account => { this.account = account - this.currentRoute = '/account/' + this.account.id + '/videos' + this.currentRoute = '/account/' + this.account.nameWithHost + '/videos' - this.loadMoreVideos(this.pagination.currentPage) + this.reloadVideos() this.generateSyndicationList() }) } ngOnDestroy () { + if (this.accountSub) this.accountSub.unsubscribe() + super.ngOnDestroy() } -- cgit v1.2.3