aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+page-not-found/page-not-found.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-08 10:32:33 +0200
committerChocobozzz <me@florianbigard.com>2022-07-08 10:58:05 +0200
commitc0e3d9ff9019fc3af9791bd20e1430724b2a043a (patch)
treec43204bf44440eda4775fd1c3355f69bfeecb76e /client/src/app/+page-not-found/page-not-found.component.ts
parentc482d2b7a6c59867973291f3ea3eca7d2db87d2a (diff)
downloadPeerTube-c0e3d9ff9019fc3af9791bd20e1430724b2a043a.tar.gz
PeerTube-c0e3d9ff9019fc3af9791bd20e1430724b2a043a.tar.zst
PeerTube-c0e3d9ff9019fc3af9791bd20e1430724b2a043a.zip
Rename not fount page to error page
Diffstat (limited to 'client/src/app/+page-not-found/page-not-found.component.ts')
-rw-r--r--client/src/app/+page-not-found/page-not-found.component.ts46
1 files changed, 0 insertions, 46 deletions
diff --git a/client/src/app/+page-not-found/page-not-found.component.ts b/client/src/app/+page-not-found/page-not-found.component.ts
deleted file mode 100644
index 10645a634..000000000
--- a/client/src/app/+page-not-found/page-not-found.component.ts
+++ /dev/null
@@ -1,46 +0,0 @@
1import { Component, OnInit } from '@angular/core'
2import { Title } from '@angular/platform-browser'
3import { Router } from '@angular/router'
4import { HttpStatusCode } from '@shared/models'
5
6@Component({
7 selector: 'my-page-not-found',
8 templateUrl: './page-not-found.component.html',
9 styleUrls: [ './page-not-found.component.scss' ]
10})
11export class PageNotFoundComponent implements OnInit {
12 status = HttpStatusCode.NOT_FOUND_404
13 type: 'video' | 'other' = 'other'
14
15 public constructor (
16 private titleService: Title,
17 private router: Router
18 ) {
19 const state = this.router.getCurrentNavigation()?.extras.state
20 this.type = state?.type || this.type
21 this.status = state?.obj.status || this.status
22 }
23
24 ngOnInit () {
25 if (this.pathname.includes('teapot')) {
26 this.status = HttpStatusCode.I_AM_A_TEAPOT_418
27 this.titleService.setTitle($localize`I'm a teapot` + ' - PeerTube')
28 }
29 }
30
31 get pathname () {
32 return window.location.pathname
33 }
34
35 getMascotName () {
36 switch (this.status) {
37 case HttpStatusCode.I_AM_A_TEAPOT_418:
38 return 'happy'
39 case HttpStatusCode.FORBIDDEN_403:
40 return 'arguing'
41 case HttpStatusCode.NOT_FOUND_404:
42 default:
43 return 'defeated'
44 }
45 }
46}