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