From a51bad1accfade25916db0dadaeb879a182cf19b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 31 May 2018 11:35:01 +0200 Subject: Add 404 page --- client/src/app/+accounts/accounts.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'client/src/app/+accounts') diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index 0a52985da..24bde61ce 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core' import { ActivatedRoute } from '@angular/router' import { AccountService } from '@app/shared/account/account.service' import { Account } from '@app/shared/account/account.model' +import { RestExtractor } from '@app/shared' +import { catchError } from 'rxjs/operators' @Component({ templateUrl: './accounts.component.html', @@ -12,13 +14,15 @@ export class AccountsComponent implements OnInit { constructor ( private route: ActivatedRoute, - private accountService: AccountService + private accountService: AccountService, + private restExtractor: RestExtractor ) {} ngOnInit () { const accountId = this.route.snapshot.params['accountId'] this.accountService.getAccount(accountId) + .pipe(catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ]))) .subscribe(account => this.account = account) } } -- cgit v1.2.3