]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/app-routing.module.ts
Reorganize client shared modules
[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 { AppComponent } from '@app/app.component'
4 import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
5 import { MenuGuards } from '@app/core/routing/menu-guard.service'
6 import { PreloadSelectedModulesList } from './core'
7
8 const routes: Routes = [
9 {
10 path: 'admin',
11 canActivate: [ MenuGuards.close() ],
12 canDeactivate: [ MenuGuards.open() ],
13 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule)
14 },
15 {
16 path: 'my-account',
17 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule)
18 },
19 {
20 path: 'verify-account',
21 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule)
22 },
23 {
24 path: 'accounts',
25 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule)
26 },
27 {
28 path: 'video-channels',
29 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule)
30 },
31 {
32 path: 'about',
33 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule)
34 },
35 {
36 path: 'signup',
37 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule)
38 },
39 {
40 path: '',
41 component: AppComponent // Avoid 404, app component will redirect dynamically
42 },
43 {
44 path: '**',
45 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
46 }
47 ]
48
49 @NgModule({
50 imports: [
51 RouterModule.forRoot(routes, {
52 useHash: Boolean(history.pushState) === false,
53 scrollPositionRestoration: 'disabled',
54 preloadingStrategy: PreloadSelectedModulesList,
55 anchorScrolling: 'disabled'
56 })
57 ],
58 providers: [
59 MenuGuards.guards,
60 PreloadSelectedModulesList,
61 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
62 ],
63 exports: [ RouterModule ]
64 })
65 export class AppRoutingModule {}