]>
Commit | Line | Data |
---|---|---|
734a5ceb | 1 | import { Component, OnInit, OnDestroy } from '@angular/core' |
db400f44 | 2 | import { ActivatedRoute } from '@angular/router' |
0626e7af C |
3 | import { Account } from '@app/shared/account/account.model' |
4 | import { AccountService } from '@app/shared/account/account.service' | |
b1d40cff | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
734a5ceb | 6 | import { Subscription } from 'rxjs' |
0626e7af C |
7 | |
8 | @Component({ | |
9 | selector: 'my-account-about', | |
10 | templateUrl: './account-about.component.html', | |
11 | styleUrls: [ './account-about.component.scss' ] | |
12 | }) | |
734a5ceb | 13 | export class AccountAboutComponent implements OnInit, OnDestroy { |
6b738c7a | 14 | account: Account |
0626e7af | 15 | |
734a5ceb C |
16 | private accountSub: Subscription |
17 | ||
0626e7af | 18 | constructor ( |
b1d40cff C |
19 | private route: ActivatedRoute, |
20 | private i18n: I18n, | |
0626e7af C |
21 | private accountService: AccountService |
22 | ) { } | |
23 | ||
24 | ngOnInit () { | |
25 | // Parent get the account for us | |
734a5ceb | 26 | this.accountSub = this.accountService.accountLoaded |
0626e7af C |
27 | .subscribe(account => this.account = account) |
28 | } | |
29 | ||
734a5ceb C |
30 | ngOnDestroy () { |
31 | if (this.accountSub) this.accountSub.unsubscribe() | |
32 | } | |
33 | ||
0626e7af C |
34 | getAccountDescription () { |
35 | if (this.account.description) return this.account.description | |
36 | ||
b1d40cff | 37 | return this.i18n('No description') |
0626e7af C |
38 | } |
39 | } |