aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+page-not-found/page-not-found.component.ts
diff options
context:
space:
mode:
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.ts31
1 files changed, 29 insertions, 2 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
index c91bb8649..81830d415 100644
--- a/client/src/app/+page-not-found/page-not-found.component.ts
+++ b/client/src/app/+page-not-found/page-not-found.component.ts
@@ -1,10 +1,37 @@
1import { Component } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { Title } from '@angular/platform-browser'
3import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
2 4
3@Component({ 5@Component({
4 selector: 'my-page-not-found', 6 selector: 'my-page-not-found',
5 templateUrl: './page-not-found.component.html', 7 templateUrl: './page-not-found.component.html',
6 styleUrls: [ './page-not-found.component.scss' ] 8 styleUrls: [ './page-not-found.component.scss' ]
7}) 9})
8export class PageNotFoundComponent { 10export class PageNotFoundComponent implements OnInit {
11 status = HttpStatusCode.NOT_FOUND_404
9 12
13 public constructor (
14 private titleService: Title
15 ) {}
16
17 ngOnInit () {
18 if (this.pathname.includes('teapot')) {
19 this.status = HttpStatusCode.I_AM_A_TEAPOT_418
20 this.titleService.setTitle($localize`I'm a teapot` + ' - PeerTube')
21 }
22 }
23
24 get pathname () {
25 return window.location.pathname
26 }
27
28 getMascotName () {
29 switch (this.status) {
30 case HttpStatusCode.I_AM_A_TEAPOT_418:
31 return 'happy'
32 case HttpStatusCode.NOT_FOUND_404:
33 default:
34 return 'defeated'
35 }
36 }
10} 37}