]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/app-routing.module.ts
Display account/channel creation date in title
[github/Chocobozzz/PeerTube.git] / client / src / app / app-routing.module.ts
... / ...
CommitLineData
1import { NgModule } from '@angular/core'
2import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router'
3import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
4import { MenuGuards } from '@app/core/routing/menu-guard.service'
5import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
6import { PreloadSelectedModulesList } from './core'
7import { EmptyComponent } from './empty.component'
8
9const routes: Routes = [
10 {
11 path: 'admin',
12 canActivate: [ MenuGuards.close() ],
13 canDeactivate: [ MenuGuards.open() ],
14 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule)
15 },
16 {
17 path: 'my-account',
18 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule)
19 },
20 {
21 path: 'my-library',
22 loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule)
23 },
24 {
25 path: 'verify-account',
26 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule)
27 },
28 {
29 path: 'accounts',
30 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule)
31 },
32 {
33 path: 'video-channels',
34 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule)
35 },
36 {
37 path: 'about',
38 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule)
39 },
40 {
41 path: 'signup',
42 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule)
43 },
44 {
45 path: 'reset-password',
46 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule)
47 },
48 {
49 path: 'login',
50 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule)
51 },
52 {
53 path: 'search',
54 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule)
55 },
56 {
57 path: 'videos',
58 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule)
59 },
60 {
61 path: 'remote-interaction',
62 loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule)
63 },
64 {
65 path: 'video-playlists/watch',
66 redirectTo: 'videos/watch/playlist'
67 },
68 {
69 path: '',
70 component: EmptyComponent // Avoid 404, app component will redirect dynamically
71 }
72]
73
74// Avoid 404 when changing language
75for (const locale of POSSIBLE_LOCALES) {
76 routes.push({
77 path: locale,
78 component: EmptyComponent
79 })
80}
81
82routes.push({
83 path: '**',
84 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
85})
86
87@NgModule({
88 imports: [
89 RouterModule.forRoot(routes, {
90 useHash: Boolean(history.pushState) === false,
91 scrollPositionRestoration: 'disabled',
92 preloadingStrategy: PreloadSelectedModulesList,
93 anchorScrolling: 'disabled'
94 })
95 ],
96 providers: [
97 MenuGuards.guards,
98 PreloadSelectedModulesList,
99 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
100 ],
101 exports: [ RouterModule ]
102})
103export class AppRoutingModule {}