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