]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/app-routing.module.ts
only count comments from people other than the video author
[github/Chocobozzz/PeerTube.git] / client / src / app / app-routing.module.ts
1 import { NgModule } from '@angular/core'
2 import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router'
3 import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
4 import { MenuGuards } from '@app/core/routing/menu-guard.service'
5 import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
6 import { PreloadSelectedModulesList } from './core'
7 import { EmptyComponent } from './empty.component'
8
9 const 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: '',
66 component: EmptyComponent // Avoid 404, app component will redirect dynamically
67 }
68 ]
69
70 // Avoid 404 when changing language
71 for (const locale of POSSIBLE_LOCALES) {
72 routes.push({
73 path: locale,
74 component: EmptyComponent
75 })
76 }
77
78 routes.push({
79 path: '**',
80 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
81 })
82
83 @NgModule({
84 imports: [
85 RouterModule.forRoot(routes, {
86 useHash: Boolean(history.pushState) === false,
87 scrollPositionRestoration: 'disabled',
88 preloadingStrategy: PreloadSelectedModulesList,
89 anchorScrolling: 'disabled'
90 })
91 ],
92 providers: [
93 MenuGuards.guards,
94 PreloadSelectedModulesList,
95 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
96 ],
97 exports: [ RouterModule ]
98 })
99 export class AppRoutingModule {}