diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-07 11:19:26 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-07 11:19:26 +0200 |
commit | 734a5ceb3d04088743d72babcb9b05e6142043f6 (patch) | |
tree | 965bfbd0bf930cf4cc9568a5dc801c4e3909a1b4 /client/src/app/+accounts/account-about | |
parent | cc69c8db39f48b1053c246458541ccc406228711 (diff) | |
download | PeerTube-734a5ceb3d04088743d72babcb9b05e6142043f6.tar.gz PeerTube-734a5ceb3d04088743d72babcb9b05e6142043f6.tar.zst PeerTube-734a5ceb3d04088743d72babcb9b05e6142043f6.zip |
Fix account/channel pages route subscription
Diffstat (limited to 'client/src/app/+accounts/account-about')
-rw-r--r-- | client/src/app/+accounts/account-about/account-about.component.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/client/src/app/+accounts/account-about/account-about.component.ts b/client/src/app/+accounts/account-about/account-about.component.ts index 4086510ba..c0e793754 100644 --- a/client/src/app/+accounts/account-about/account-about.component.ts +++ b/client/src/app/+accounts/account-about/account-about.component.ts | |||
@@ -1,17 +1,20 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit, OnDestroy } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 2 | import { ActivatedRoute } from '@angular/router' |
3 | import { Account } from '@app/shared/account/account.model' | 3 | import { Account } from '@app/shared/account/account.model' |
4 | import { AccountService } from '@app/shared/account/account.service' | 4 | import { AccountService } from '@app/shared/account/account.service' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | import { Subscription } from 'rxjs' | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'my-account-about', | 9 | selector: 'my-account-about', |
9 | templateUrl: './account-about.component.html', | 10 | templateUrl: './account-about.component.html', |
10 | styleUrls: [ './account-about.component.scss' ] | 11 | styleUrls: [ './account-about.component.scss' ] |
11 | }) | 12 | }) |
12 | export class AccountAboutComponent implements OnInit { | 13 | export class AccountAboutComponent implements OnInit, OnDestroy { |
13 | account: Account | 14 | account: Account |
14 | 15 | ||
16 | private accountSub: Subscription | ||
17 | |||
15 | constructor ( | 18 | constructor ( |
16 | private route: ActivatedRoute, | 19 | private route: ActivatedRoute, |
17 | private i18n: I18n, | 20 | private i18n: I18n, |
@@ -20,10 +23,14 @@ export class AccountAboutComponent implements OnInit { | |||
20 | 23 | ||
21 | ngOnInit () { | 24 | ngOnInit () { |
22 | // Parent get the account for us | 25 | // Parent get the account for us |
23 | this.accountService.accountLoaded | 26 | this.accountSub = this.accountService.accountLoaded |
24 | .subscribe(account => this.account = account) | 27 | .subscribe(account => this.account = account) |
25 | } | 28 | } |
26 | 29 | ||
30 | ngOnDestroy () { | ||
31 | if (this.accountSub) this.accountSub.unsubscribe() | ||
32 | } | ||
33 | |||
27 | getAccountDescription () { | 34 | getAccountDescription () { |
28 | if (this.account.description) return this.account.description | 35 | if (this.account.description) return this.account.description |
29 | 36 | ||