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 { PreloadSelectedModulesList } from './core'
6 import { EmptyComponent } from './empty.component'
7 import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
9 const routes: Routes = [
12 canActivate: [ MenuGuards.close() ],
13 canDeactivate: [ MenuGuards.open() ],
14 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule)
18 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule)
22 loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule)
25 path: 'verify-account',
26 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule)
30 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule)
33 path: 'video-channels',
34 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule)
38 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule)
42 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule)
45 path: 'reset-password',
46 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule)
50 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule)
54 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule)
58 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule)
62 component: EmptyComponent // Avoid 404, app component will redirect dynamically
66 // Avoid 404 when changing language
67 for (const locale of POSSIBLE_LOCALES) {
70 component: EmptyComponent
76 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
81 RouterModule.forRoot(routes, {
82 useHash: Boolean(history.pushState) === false,
83 scrollPositionRestoration: 'disabled',
84 preloadingStrategy: PreloadSelectedModulesList,
85 anchorScrolling: 'disabled'
90 PreloadSelectedModulesList,
91 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
93 exports: [ RouterModule ]
95 export class AppRoutingModule {}