diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-31 11:35:01 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-31 14:24:13 +0200 |
commit | a51bad1accfade25916db0dadaeb879a182cf19b (patch) | |
tree | 128330863a1125be437cf8ba9bc0c6c529068520 /client/src/app/shared | |
parent | 351d5225d6a4fe6863f760f02454eac88f730607 (diff) | |
download | PeerTube-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.ts | 16 |
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 @@ | |||
1 | import { of, throwError as observableThrowError } from 'rxjs' | 1 | import { throwError as observableThrowError } from 'rxjs' |
2 | import { Injectable } from '@angular/core' | 2 | import { Injectable } from '@angular/core' |
3 | import { dateToHuman } from '@app/shared/misc/utils' | 3 | import { dateToHuman } from '@app/shared/misc/utils' |
4 | import { ResultList } from '../../../../../shared' | 4 | import { ResultList } from '../../../../../shared' |
5 | import { Router } from '@angular/router' | ||
5 | 6 | ||
6 | @Injectable() | 7 | @Injectable() |
7 | export class RestExtractor { | 8 | export 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 | } |