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/+video-channels/video-channels.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'client/src/app/+video-channels/video-channels.component.ts') diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts index 5eca64fb5..09541b370 100644 --- a/client/src/app/+video-channels/video-channels.component.ts +++ b/client/src/app/+video-channels/video-channels.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core' import { ActivatedRoute } from '@angular/router' import { VideoChannel } from '@app/shared/video-channel/video-channel.model' import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' +import { RestExtractor } from '@app/shared' +import { catchError } from 'rxjs/operators' @Component({ templateUrl: './video-channels.component.html', @@ -12,13 +14,15 @@ export class VideoChannelsComponent implements OnInit { constructor ( private route: ActivatedRoute, - private videoChannelService: VideoChannelService + private videoChannelService: VideoChannelService, + private restExtractor: RestExtractor ) {} ngOnInit () { const videoChannelId = this.route.snapshot.params['videoChannelId'] this.videoChannelService.getVideoChannel(videoChannelId) + .pipe(catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ]))) .subscribe(videoChannel => this.videoChannel = videoChannel) } } -- cgit v1.2.3