aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
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/shared
parent351d5225d6a4fe6863f760f02454eac88f730607 (diff)
downloadPeerTube-a51bad1accfade25916db0dadaeb879a182cf19b.tar.gz
PeerTube-a51bad1accfade25916db0dadaeb879a182cf19b.tar.zst
PeerTube-a51bad1accfade25916db0dadaeb879a182cf19b.zip
Add 404 page
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/rest/rest-extractor.service.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts
index db087d407..39e601e20 100644
--- a/client/src/app/shared/rest/rest-extractor.service.ts
+++ b/client/src/app/shared/rest/rest-extractor.service.ts
@@ -1,11 +1,16 @@
1import { of, throwError as observableThrowError } from 'rxjs' 1import { throwError as observableThrowError } from 'rxjs'
2import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
3import { dateToHuman } from '@app/shared/misc/utils' 3import { dateToHuman } from '@app/shared/misc/utils'
4import { ResultList } from '../../../../../shared' 4import { ResultList } from '../../../../../shared'
5import { Router } from '@angular/router'
5 6
6@Injectable() 7@Injectable()
7export class RestExtractor { 8export class RestExtractor {
8 9
10 constructor (private router: Router) {
11 // empty
12 }
13
9 extractDataBool () { 14 extractDataBool () {
10 return true 15 return true
11 } 16 }
@@ -87,4 +92,13 @@ export class RestExtractor {
87 92
88 return observableThrowError(errorObj) 93 return observableThrowError(errorObj)
89 } 94 }
95
96 redirectTo404IfNotFound (obj: { status: number }, status = [ 404 ]) {
97 if (obj && obj.status && status.indexOf(obj.status) !== -1) {
98 // Do not use redirectService to avoid circular dependencies
99 this.router.navigate([ '/404' ], { skipLocationChange: true })
100 }
101
102 return observableThrowError(obj)
103 }
90} 104}