]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/app-routing.module.ts
Fix table header overflow
[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 { PreloadSelectedModulesList } from './core'
6import { EmptyComponent } from './empty.component'
7import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
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: '',
62 component: EmptyComponent // Avoid 404, app component will redirect dynamically
63 }
64]
65
66// Avoid 404 when changing language
67for (const locale of POSSIBLE_LOCALES) {
68 routes.push({
69 path: locale,
70 component: EmptyComponent
71 })
72}
73
74routes.push({
75 path: '**',
76 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
77})
78
79@NgModule({
80 imports: [
81 RouterModule.forRoot(routes, {
82 useHash: Boolean(history.pushState) === false,
83 scrollPositionRestoration: 'disabled',
84 preloadingStrategy: PreloadSelectedModulesList,
85 anchorScrolling: 'disabled'
86 })
87 ],
88 providers: [
89 MenuGuards.guards,
90 PreloadSelectedModulesList,
91 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
92 ],
93 exports: [ RouterModule ]
94})
95export class AppRoutingModule {}