]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/app-routing.module.ts
Check live duration and size
[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'
67ed6552 5import { PreloadSelectedModulesList } from './core'
1942f11d 6import { EmptyComponent } from './empty.component'
ca00baa7 7import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
693b1aba
C
8
9const routes: Routes = [
4b4f22fc
C
10 {
11 path: 'admin',
3b20bdd6
RK
12 canActivate: [ MenuGuards.close() ],
13 canDeactivate: [ MenuGuards.open() ],
f36da21e 14 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule)
4b4f22fc
C
15 },
16 {
17 path: 'my-account',
f36da21e 18 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule)
4b4f22fc 19 },
d9eaee39
JM
20 {
21 path: 'verify-account',
f36da21e 22 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule)
d9eaee39 23 },
4b4f22fc
C
24 {
25 path: 'accounts',
f36da21e 26 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule)
4b4f22fc
C
27 },
28 {
29 path: 'video-channels',
f36da21e 30 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule)
a51bad1a 31 },
78f912ed
C
32 {
33 path: 'about',
f36da21e 34 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule)
78f912ed 35 },
b247a132
C
36 {
37 path: 'signup',
f36da21e 38 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule)
b247a132 39 },
1942f11d
C
40 {
41 path: 'reset-password',
42 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule)
43 },
44 {
45 path: 'login',
46 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule)
47 },
48 {
49 path: 'search',
50 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule)
51 },
52 {
53 path: 'videos',
54 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule)
55 },
b889cdb2
C
56 {
57 path: '',
1942f11d 58 component: EmptyComponent // Avoid 404, app component will redirect dynamically
4b4f22fc 59 }
df98563e 60]
693b1aba 61
ca00baa7
C
62// Avoid 404 when changing language
63for (const locale of POSSIBLE_LOCALES) {
64 routes.push({
65 path: locale,
66 component: EmptyComponent
67 })
68}
69
70routes.push({
71 path: '**',
72 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
73})
74
693b1aba 75@NgModule({
04de542a
C
76 imports: [
77 RouterModule.forRoot(routes, {
78 useHash: Boolean(history.pushState) === false,
489290b8 79 scrollPositionRestoration: 'disabled',
07a98236 80 preloadingStrategy: PreloadSelectedModulesList,
489290b8 81 anchorScrolling: 'disabled'
04de542a
C
82 })
83 ],
901637bb 84 providers: [
3b20bdd6 85 MenuGuards.guards,
489290b8
C
86 PreloadSelectedModulesList,
87 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
901637bb 88 ],
693b1aba
C
89 exports: [ RouterModule ]
90})
91export class AppRoutingModule {}