Add i18n attributes
[oweals/peertube.git] / client / src / app / +accounts / accounts.component.ts
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 import { RestExtractor } from '@app/shared'
6 import { catchError } from 'rxjs/operators'
7
8 @Component({
9   templateUrl: './accounts.component.html',
10   styleUrls: [ './accounts.component.scss' ]
11 })
12 export class AccountsComponent implements OnInit {
13   account: Account
14
15   constructor (
16     private route: ActivatedRoute,
17     private accountService: AccountService,
18     private restExtractor: RestExtractor
19   ) {}
20
21   ngOnInit () {
22     const accountId = this.route.snapshot.params['accountId']
23
24     this.accountService.getAccount(accountId)
25         .pipe(catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])))
26         .subscribe(account => this.account = account)
27   }
28 }