]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/app-routing.module.ts
Remove ngx-meta
[github/Chocobozzz/PeerTube.git] / client / src / app / app-routing.module.ts
CommitLineData
df98563e 1import { NgModule } from '@angular/core'
489290b8 2import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router'
489290b8 3import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
3b20bdd6 4import { MenuGuards } from '@app/core/routing/menu-guard.service'
d43c6b1f 5import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
0f01a8ba 6import { MetaGuard, PreloadSelectedModulesList } from './core'
1942f11d 7import { EmptyComponent } from './empty.component'
693b1aba
C
8
9const routes: Routes = [
4b4f22fc
C
10 {
11 path: 'admin',
3b20bdd6
RK
12 canActivate: [ MenuGuards.close() ],
13 canDeactivate: [ MenuGuards.open() ],
0f01a8ba
C
14 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule),
15 canActivateChild: [ MetaGuard ]
4b4f22fc 16 },
2539932e
C
17 {
18 path: 'home',
19 loadChildren: () => import('./+home/home.module').then(m => m.HomeModule)
20 },
4b4f22fc
C
21 {
22 path: 'my-account',
0f01a8ba
C
23 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule),
24 canActivateChild: [ MetaGuard ]
4b4f22fc 25 },
17119e4a
C
26 {
27 path: 'my-library',
0f01a8ba
C
28 loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule),
29 canActivateChild: [ MetaGuard ]
17119e4a 30 },
d9eaee39
JM
31 {
32 path: 'verify-account',
0f01a8ba
C
33 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule),
34 canActivateChild: [ MetaGuard ]
d9eaee39 35 },
4b4f22fc
C
36 {
37 path: 'accounts',
0f01a8ba
C
38 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule),
39 canActivateChild: [ MetaGuard ]
4b4f22fc
C
40 },
41 {
42 path: 'video-channels',
0f01a8ba
C
43 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule),
44 canActivateChild: [ MetaGuard ]
a51bad1a 45 },
78f912ed
C
46 {
47 path: 'about',
0f01a8ba
C
48 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule),
49 canActivateChild: [ MetaGuard ]
78f912ed 50 },
b247a132
C
51 {
52 path: 'signup',
0f01a8ba
C
53 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule),
54 canActivateChild: [ MetaGuard ]
b247a132 55 },
1942f11d
C
56 {
57 path: 'reset-password',
0f01a8ba
C
58 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule),
59 canActivateChild: [ MetaGuard ]
1942f11d
C
60 },
61 {
62 path: 'login',
0f01a8ba
C
63 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule),
64 canActivateChild: [ MetaGuard ]
1942f11d
C
65 },
66 {
67 path: 'search',
0f01a8ba
C
68 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule),
69 canActivateChild: [ MetaGuard ]
1942f11d
C
70 },
71 {
72 path: 'videos',
0f01a8ba
C
73 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule),
74 canActivateChild: [ MetaGuard ]
1942f11d 75 },
d43c6b1f
C
76 {
77 path: 'remote-interaction',
0f01a8ba
C
78 loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule),
79 canActivateChild: [ MetaGuard ]
d43c6b1f 80 },
0bd6d35f
C
81 {
82 path: 'video-playlists/watch',
83 redirectTo: 'videos/watch/playlist'
84 },
b889cdb2
C
85 {
86 path: '',
1942f11d 87 component: EmptyComponent // Avoid 404, app component will redirect dynamically
4b4f22fc 88 }
df98563e 89]
693b1aba 90
ca00baa7
C
91// Avoid 404 when changing language
92for (const locale of POSSIBLE_LOCALES) {
93 routes.push({
94 path: locale,
95 component: EmptyComponent
96 })
97}
98
99routes.push({
100 path: '**',
101 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
102})
103
693b1aba 104@NgModule({
04de542a
C
105 imports: [
106 RouterModule.forRoot(routes, {
107 useHash: Boolean(history.pushState) === false,
489290b8 108 scrollPositionRestoration: 'disabled',
07a98236 109 preloadingStrategy: PreloadSelectedModulesList,
489290b8 110 anchorScrolling: 'disabled'
04de542a
C
111 })
112 ],
901637bb 113 providers: [
3b20bdd6 114 MenuGuards.guards,
489290b8
C
115 PreloadSelectedModulesList,
116 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
901637bb 117 ],
693b1aba
C
118 exports: [ RouterModule ]
119})
120export class AppRoutingModule {}