aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-28 14:01:18 +0200
committerChocobozzz <me@florianbigard.com>2021-05-28 14:01:18 +0200
commitdaa45ded44f0e7329a8ea88024275b0bb69ea0cb (patch)
treebc907cf64566fd6c925ce5b8732c5a0758ea6b39
parent1f256e7d3cf056c2d999260155cdba58ae1b878b (diff)
downloadPeerTube-daa45ded44f0e7329a8ea88024275b0bb69ea0cb.tar.gz
PeerTube-daa45ded44f0e7329a8ea88024275b0bb69ea0cb.tar.zst
PeerTube-daa45ded44f0e7329a8ea88024275b0bb69ea0cb.zip
Remove unused component
-rw-r--r--client/src/app/root.component.ts44
1 files changed, 0 insertions, 44 deletions
diff --git a/client/src/app/root.component.ts b/client/src/app/root.component.ts
deleted file mode 100644
index 5a09e50d1..000000000
--- a/client/src/app/root.component.ts
+++ /dev/null
@@ -1,44 +0,0 @@
1import { Component, OnInit } from '@angular/core'
2import { catchError, distinctUntilChanged, map, switchMap } from 'rxjs/operators'
3import { ActivatedRoute, Router } from '@angular/router'
4import { RestExtractor } from '@app/core'
5import { ActorService } from '@app/shared/shared-main/account'
6import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
7
8@Component({
9 selector: 'my-root',
10 template: ''
11})
12export class RootComponent implements OnInit {
13 constructor (
14 private actorService: ActorService,
15 private route: ActivatedRoute,
16 private restExtractor: RestExtractor,
17 private router: Router
18 ) {
19 }
20
21 ngOnInit () {
22 this.route.params
23 .pipe(
24 map(params => params[ 'actorName' ]),
25 distinctUntilChanged(),
26 switchMap(actorName => this.actorService.getActorType(actorName)),
27 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, 'other', [
28 HttpStatusCode.BAD_REQUEST_400,
29 HttpStatusCode.NOT_FOUND_404
30 ]))
31 )
32 .subscribe(actorType => {
33 const actorName = this.route.snapshot.params[ 'actorName' ]
34
35 if (actorType === 'Account') {
36 this.router.navigate([ `/a/${actorName}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true })
37 }
38
39 if (actorType === 'VideoChannel') {
40 this.router.navigate([ `/c/${actorName}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true })
41 }
42 })
43 }
44}