]>
Commit | Line | Data |
---|---|---|
df98563e | 1 | import { NgModule } from '@angular/core' |
dd24f1bb | 2 | import { RouterModule, Routes, UrlSegment } from '@angular/router' |
ba5d4a84 | 3 | import { LoginGuard } from '@app/core' |
dd24f1bb | 4 | import { VideosListCommonPageComponent } from './video-list' |
1942f11d | 5 | import { VideoOverviewComponent } from './video-list/overview/video-overview.component' |
67ed6552 | 6 | import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component' |
0629423c | 7 | |
693b1aba | 8 | const videosRoutes: Routes = [ |
0629423c | 9 | { |
1942f11d | 10 | path: '', |
0629423c | 11 | children: [ |
2d3741d6 C |
12 | { |
13 | path: 'overview', | |
14 | component: VideoOverviewComponent, | |
15 | data: { | |
16 | meta: { | |
f29f487e | 17 | title: $localize`Discover videos` |
2d3741d6 C |
18 | } |
19 | } | |
20 | }, | |
dd24f1bb | 21 | |
0629423c | 22 | { |
dd24f1bb | 23 | // Old URL redirection |
c07eb946 | 24 | path: 'most-liked', |
dd24f1bb | 25 | redirectTo: 'trending?sort=most-liked' |
c07eb946 | 26 | }, |
9bf9d2a5 | 27 | { |
dd24f1bb C |
28 | matcher: (url: UrlSegment[]) => { |
29 | if (url.length === 1 && [ 'recently-added', 'trending', 'local' ].includes(url[0].path)) { | |
30 | return { | |
31 | consumed: url, | |
32 | posParams: { | |
33 | page: new UrlSegment(url[0].path, {}) | |
34 | } | |
35 | } | |
36 | } | |
37 | ||
38 | return null | |
39 | }, | |
40 | ||
41 | component: VideosListCommonPageComponent, | |
b58c69a1 | 42 | data: { |
489290b8 C |
43 | reuse: { |
44 | enabled: true, | |
dd24f1bb | 45 | key: 'videos-list' |
b58c69a1 C |
46 | } |
47 | } | |
0629423c | 48 | }, |
dd24f1bb | 49 | |
066e94c5 | 50 | { |
22a16e36 | 51 | path: 'subscriptions', |
b2dd58a8 | 52 | canActivate: [ LoginGuard ], |
22a16e36 C |
53 | component: VideoUserSubscriptionsComponent, |
54 | data: { | |
55 | meta: { | |
f29f487e | 56 | title: $localize`Subscriptions` |
489290b8 C |
57 | }, |
58 | reuse: { | |
59 | enabled: true, | |
60 | key: 'subscription-videos-list' | |
22a16e36 C |
61 | } |
62 | } | |
0629423c C |
63 | } |
64 | ] | |
65 | } | |
df98563e | 66 | ] |
693b1aba C |
67 | |
68 | @NgModule({ | |
69 | imports: [ RouterModule.forChild(videosRoutes) ], | |
70 | exports: [ RouterModule ] | |
71 | }) | |
72 | export class VideosRoutingModule {} |