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 { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
6 import { PreloadSelectedModulesList } from './core'
7 import { EmptyComponent } from './empty.component'
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('./+home/home.module').then(m => m.HomeModule)
22 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule)
26 loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule)
29 path: 'verify-account',
30 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule)
34 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule)
37 path: 'video-channels',
38 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule)
42 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule)
46 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule)
49 path: 'reset-password',
50 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule)
54 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule)
58 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule)
62 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule)
65 path: 'remote-interaction',
66 loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule)
69 path: 'video-playlists/watch',
70 redirectTo: 'videos/watch/playlist'
74 component: EmptyComponent // Avoid 404, app component will redirect dynamically
78 // Avoid 404 when changing language
79 for (const locale of POSSIBLE_LOCALES) {
82 component: EmptyComponent
88 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
93 RouterModule.forRoot(routes, {
94 useHash: Boolean(history.pushState) === false,
95 scrollPositionRestoration: 'disabled',
96 preloadingStrategy: PreloadSelectedModulesList,
97 anchorScrolling: 'disabled'
102 PreloadSelectedModulesList,
103 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
105 exports: [ RouterModule ]
107 export class AppRoutingModule {}