]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/app-routing.module.ts
Lazy load all routes
[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'
b889cdb2 3import { AppComponent } from '@app/app.component'
489290b8 4import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
3b20bdd6 5import { MenuGuards } from '@app/core/routing/menu-guard.service'
67ed6552 6import { 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() ],
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
b889cdb2 59 },
a51bad1a
C
60 {
61 path: '**',
f36da21e 62 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
4b4f22fc 63 }
df98563e 64]
693b1aba
C
65
66@NgModule({
04de542a
C
67 imports: [
68 RouterModule.forRoot(routes, {
69 useHash: Boolean(history.pushState) === false,
489290b8 70 scrollPositionRestoration: 'disabled',
07a98236 71 preloadingStrategy: PreloadSelectedModulesList,
489290b8 72 anchorScrolling: 'disabled'
04de542a
C
73 })
74 ],
901637bb 75 providers: [
3b20bdd6 76 MenuGuards.guards,
489290b8
C
77 PreloadSelectedModulesList,
78 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
901637bb 79 ],
693b1aba
C
80 exports: [ RouterModule ]
81})
82export class AppRoutingModule {}