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'
9 templateUrl: './accounts.component.html',
10 styleUrls: [ './accounts.component.scss' ]
12 export class AccountsComponent implements OnInit {
16 private route: ActivatedRoute,
17 private accountService: AccountService,
18 private restExtractor: RestExtractor
22 const accountId = this.route.snapshot.params['accountId']
24 this.accountService.getAccount(accountId)
25 .pipe(catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])))
26 .subscribe(account => this.account = account)