aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app-routing.module.ts
diff options
context:
space:
mode:
authorKimsible <kimsible@users.noreply.github.com>2021-04-28 22:17:02 +0200
committerKimsible <kimsible@users.noreply.github.com>2021-05-05 11:47:03 +0200
commit69e076ddb0deda9e4120bab095d3369bb19fbd1e (patch)
tree6576a6293b9e76ce385813f62376e15a7e05001f /client/src/app/app-routing.module.ts
parent08ac081b37cd6115634e8951608116fe0f13032b (diff)
downloadPeerTube-69e076ddb0deda9e4120bab095d3369bb19fbd1e.tar.gz
PeerTube-69e076ddb0deda9e4120bab095d3369bb19fbd1e.tar.zst
PeerTube-69e076ddb0deda9e4120bab095d3369bb19fbd1e.zip
Refactor client @actorName matcher with new API route
Diffstat (limited to 'client/src/app/app-routing.module.ts')
-rw-r--r--client/src/app/app-routing.module.ts20
1 files changed, 16 insertions, 4 deletions
diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts
index c0a2d29e4..23fd52e8b 100644
--- a/client/src/app/app-routing.module.ts
+++ b/client/src/app/app-routing.module.ts
@@ -1,11 +1,11 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router' 2import { RouteReuseStrategy, RouterModule, Routes, UrlMatchResult, UrlSegment } from '@angular/router'
3import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy' 3import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
4import { MenuGuards } from '@app/core/routing/menu-guard.service' 4import { MenuGuards } from '@app/core/routing/menu-guard.service'
5import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n' 5import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
6import { PreloadSelectedModulesList } from './core' 6import { PreloadSelectedModulesList } from './core'
7import { EmptyComponent } from './empty.component' 7import { EmptyComponent } from './empty.component'
8import { ActorsComponent } from './+actors/actors.component' 8import { RootComponent } from './root.component'
9 9
10const routes: Routes = [ 10const routes: Routes = [
11 { 11 {
@@ -75,8 +75,20 @@ const routes: Routes = [
75 redirectTo: 'video-channels' 75 redirectTo: 'video-channels'
76 }, 76 },
77 { 77 {
78 path: ':actorName', 78 matcher: (url): UrlMatchResult => {
79 component: ActorsComponent 79 // Matches /@:actorName
80 if (url.length === 1 && url[0].path.match(/^@[\w]+$/gm)) {
81 return {
82 consumed: url,
83 posParams: {
84 actorName: new UrlSegment(url[0].path.substr(1), {})
85 }
86 }
87 }
88
89 return null
90 },
91 component: RootComponent
80 }, 92 },
81 { 93 {
82 path: '', 94 path: '',