]>
Commit | Line | Data |
---|---|---|
df98563e | 1 | import { NgModule } from '@angular/core' |
489290b8 | 2 | import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router' |
489290b8 | 3 | import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy' |
3b20bdd6 | 4 | import { MenuGuards } from '@app/core/routing/menu-guard.service' |
d43c6b1f | 5 | import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n' |
67ed6552 | 6 | import { PreloadSelectedModulesList } from './core' |
1942f11d | 7 | import { EmptyComponent } from './empty.component' |
693b1aba C |
8 | |
9 | const routes: Routes = [ | |
4b4f22fc C |
10 | { |
11 | path: 'admin', | |
3b20bdd6 RK |
12 | canActivate: [ MenuGuards.close() ], |
13 | canDeactivate: [ MenuGuards.open() ], | |
f36da21e | 14 | loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule) |
4b4f22fc C |
15 | }, |
16 | { | |
17 | path: 'my-account', | |
f36da21e | 18 | loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule) |
4b4f22fc | 19 | }, |
17119e4a C |
20 | { |
21 | path: 'my-library', | |
22 | loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule) | |
23 | }, | |
d9eaee39 JM |
24 | { |
25 | path: 'verify-account', | |
f36da21e | 26 | loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule) |
d9eaee39 | 27 | }, |
4b4f22fc C |
28 | { |
29 | path: 'accounts', | |
f36da21e | 30 | loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule) |
4b4f22fc C |
31 | }, |
32 | { | |
33 | path: 'video-channels', | |
f36da21e | 34 | loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule) |
a51bad1a | 35 | }, |
78f912ed C |
36 | { |
37 | path: 'about', | |
f36da21e | 38 | loadChildren: () => import('./+about/about.module').then(m => m.AboutModule) |
78f912ed | 39 | }, |
b247a132 C |
40 | { |
41 | path: 'signup', | |
f36da21e | 42 | loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule) |
b247a132 | 43 | }, |
1942f11d C |
44 | { |
45 | path: 'reset-password', | |
46 | loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule) | |
47 | }, | |
48 | { | |
49 | path: 'login', | |
50 | loadChildren: () => import('./+login/login.module').then(m => m.LoginModule) | |
51 | }, | |
52 | { | |
53 | path: 'search', | |
54 | loadChildren: () => import('./+search/search.module').then(m => m.SearchModule) | |
55 | }, | |
56 | { | |
57 | path: 'videos', | |
58 | loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule) | |
59 | }, | |
d43c6b1f C |
60 | { |
61 | path: 'remote-interaction', | |
62 | loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule) | |
63 | }, | |
0bd6d35f C |
64 | { |
65 | path: 'video-playlists/watch', | |
66 | redirectTo: 'videos/watch/playlist' | |
67 | }, | |
b889cdb2 C |
68 | { |
69 | path: '', | |
1942f11d | 70 | component: EmptyComponent // Avoid 404, app component will redirect dynamically |
4b4f22fc | 71 | } |
df98563e | 72 | ] |
693b1aba | 73 | |
ca00baa7 C |
74 | // Avoid 404 when changing language |
75 | for (const locale of POSSIBLE_LOCALES) { | |
76 | routes.push({ | |
77 | path: locale, | |
78 | component: EmptyComponent | |
79 | }) | |
80 | } | |
81 | ||
82 | routes.push({ | |
83 | path: '**', | |
84 | loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule) | |
85 | }) | |
86 | ||
693b1aba | 87 | @NgModule({ |
04de542a C |
88 | imports: [ |
89 | RouterModule.forRoot(routes, { | |
90 | useHash: Boolean(history.pushState) === false, | |
489290b8 | 91 | scrollPositionRestoration: 'disabled', |
07a98236 | 92 | preloadingStrategy: PreloadSelectedModulesList, |
489290b8 | 93 | anchorScrolling: 'disabled' |
04de542a C |
94 | }) |
95 | ], | |
901637bb | 96 | providers: [ |
3b20bdd6 | 97 | MenuGuards.guards, |
489290b8 C |
98 | PreloadSelectedModulesList, |
99 | { provide: RouteReuseStrategy, useClass: CustomReuseStrategy } | |
901637bb | 100 | ], |
693b1aba C |
101 | exports: [ RouterModule ] |
102 | }) | |
103 | export class AppRoutingModule {} |