]>
Commit | Line | Data |
---|---|---|
1 | import { Component, OnInit } from '@angular/core' | |
2 | import { ActivatedRoute } from '@angular/router' | |
3 | import { AccountService } from '@app/shared/account/account.service' | |
4 | import { Account } from '@app/shared/account/account.model' | |
5 | ||
6 | @Component({ | |
7 | selector: 'my-account', | |
8 | templateUrl: './account.component.html', | |
9 | styleUrls: [ './account.component.scss' ] | |
10 | }) | |
11 | export class AccountComponent implements OnInit { | |
12 | private account: Account | |
13 | ||
14 | constructor ( | |
15 | private route: ActivatedRoute, | |
16 | private accountService: AccountService | |
17 | ) {} | |
18 | ||
19 | ngOnInit () { | |
20 | const accountId = parseInt(this.route.snapshot.params['accountId'], 10) | |
21 | ||
22 | this.accountService.getAccount(accountId) | |
23 | .subscribe(account => this.account = account) | |
24 | } | |
25 | ||
26 | getAvatarUrl () { | |
27 | return Account.GET_ACCOUNT_AVATAR_URL(this.account) | |
28 | } | |
29 | } |