aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-31 11:35:01 +0200
committerChocobozzz <me@florianbigard.com>2018-05-31 14:24:13 +0200
commita51bad1accfade25916db0dadaeb879a182cf19b (patch)
tree128330863a1125be437cf8ba9bc0c6c529068520 /client/src/app/videos/+video-watch/video-watch.component.ts
parent351d5225d6a4fe6863f760f02454eac88f730607 (diff)
downloadPeerTube-a51bad1accfade25916db0dadaeb879a182cf19b.tar.gz
PeerTube-a51bad1accfade25916db0dadaeb879a182cf19b.tar.zst
PeerTube-a51bad1accfade25916db0dadaeb879a182cf19b.zip
Add 404 page
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts32
1 files changed, 19 insertions, 13 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index c71051649..ad572ef58 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -1,3 +1,4 @@
1import { catchError } from 'rxjs/operators'
1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' 2import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
3import { RedirectService } from '@app/core/routing/redirect.service' 4import { RedirectService } from '@app/core/routing/redirect.service'
@@ -12,7 +13,7 @@ import * as WebTorrent from 'webtorrent'
12import { UserVideoRateType, VideoRateType } from '../../../../../shared' 13import { UserVideoRateType, VideoRateType } from '../../../../../shared'
13import '../../../assets/player/peertube-videojs-plugin' 14import '../../../assets/player/peertube-videojs-plugin'
14import { AuthService, ConfirmService } from '../../core' 15import { AuthService, ConfirmService } from '../../core'
15import { VideoBlacklistService } from '../../shared' 16import { RestExtractor, VideoBlacklistService } from '../../shared'
16import { VideoDetails } from '../../shared/video/video-details.model' 17import { VideoDetails } from '../../shared/video/video-details.model'
17import { Video } from '../../shared/video/video.model' 18import { Video } from '../../shared/video/video.model'
18import { VideoService } from '../../shared/video/video.service' 19import { VideoService } from '../../shared/video/video.service'
@@ -65,6 +66,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
65 private metaService: MetaService, 66 private metaService: MetaService,
66 private authService: AuthService, 67 private authService: AuthService,
67 private serverService: ServerService, 68 private serverService: ServerService,
69 private restExtractor: RestExtractor,
68 private notificationsService: NotificationsService, 70 private notificationsService: NotificationsService,
69 private markdownService: MarkdownService, 71 private markdownService: MarkdownService,
70 private zone: NgZone, 72 private zone: NgZone,
@@ -99,21 +101,25 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
99 } 101 }
100 102
101 const uuid = routeParams['uuid'] 103 const uuid = routeParams['uuid']
104
102 // Video did not change 105 // Video did not change
103 if (this.video && this.video.uuid === uuid) return 106 if (this.video && this.video.uuid === uuid) return
104 // Video did change 107 // Video did change
105 this.videoService.getVideo(uuid).subscribe( 108 this.videoService
106 video => { 109 .getVideo(uuid)
107 const startTime = this.route.snapshot.queryParams.start 110 .pipe(catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])))
108 this.onVideoFetched(video, startTime) 111 .subscribe(
109 .catch(err => this.handleError(err)) 112 video => {
110 }, 113 const startTime = this.route.snapshot.queryParams.start
111 114 this.onVideoFetched(video, startTime)
112 error => { 115 .catch(err => this.handleError(err))
113 this.videoNotFound = true 116 },
114 console.error(error) 117
115 } 118 error => {
116 ) 119 this.videoNotFound = true
120 console.error(error)
121 }
122 )
117 }) 123 })
118 } 124 }
119 125