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('./+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)
61 path: 'remote-interaction',
62 loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule)
65 path: 'video-playlists/watch',
66 redirectTo: 'videos/watch/playlist'
70 component: EmptyComponent // Avoid 404, app component will redirect dynamically
74 // Avoid 404 when changing language
75 for (const locale of POSSIBLE_LOCALES) {
78 component: EmptyComponent
84 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
89 RouterModule.forRoot(routes, {
90 useHash: Boolean(history.pushState) === false,
91 scrollPositionRestoration: 'disabled',
92 preloadingStrategy: PreloadSelectedModulesList,
93 anchorScrolling: 'disabled'
98 PreloadSelectedModulesList,
99 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
101 exports: [ RouterModule ]
103 export class AppRoutingModule {}