diff options
Diffstat (limited to 'client/src/app/root.component.ts')
-rw-r--r-- | client/src/app/root.component.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/client/src/app/root.component.ts b/client/src/app/root.component.ts index ae999e058..5a09e50d1 100644 --- a/client/src/app/root.component.ts +++ b/client/src/app/root.component.ts | |||
@@ -23,19 +23,21 @@ export class RootComponent implements OnInit { | |||
23 | .pipe( | 23 | .pipe( |
24 | map(params => params[ 'actorName' ]), | 24 | map(params => params[ 'actorName' ]), |
25 | distinctUntilChanged(), | 25 | distinctUntilChanged(), |
26 | switchMap(actorName => this.actorService.getActor(actorName)), | 26 | switchMap(actorName => this.actorService.getActorType(actorName)), |
27 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, 'other', [ | 27 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, 'other', [ |
28 | HttpStatusCode.BAD_REQUEST_400, | 28 | HttpStatusCode.BAD_REQUEST_400, |
29 | HttpStatusCode.NOT_FOUND_404 | 29 | HttpStatusCode.NOT_FOUND_404 |
30 | ])) | 30 | ])) |
31 | ) | 31 | ) |
32 | .subscribe(actor => { | 32 | .subscribe(actorType => { |
33 | if (/\/accounts\//.test(actor.url)) { | 33 | const actorName = this.route.snapshot.params[ 'actorName' ] |
34 | this.router.navigate([ `/a/${actor.name}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true }) | 34 | |
35 | if (actorType === 'Account') { | ||
36 | this.router.navigate([ `/a/${actorName}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true }) | ||
35 | } | 37 | } |
36 | 38 | ||
37 | if (/\/video-channels\//.test(actor.url)) { | 39 | if (actorType === 'VideoChannel') { |
38 | this.router.navigate([ `/c/${actor.name}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true }) | 40 | this.router.navigate([ `/c/${actorName}` ], { state: { type: 'others', obj: { status: 200 } }, skipLocationChange: true }) |
39 | } | 41 | } |
40 | }) | 42 | }) |
41 | } | 43 | } |