aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-26 08:54:19 +0200
committerChocobozzz <me@florianbigard.com>2020-08-26 08:54:19 +0200
commitca00baa75ae849b1ba4953f0ff843ff5452f6745 (patch)
tree8d90d25a9c5ec9eb14a25011c8a23138c11eda55
parent365d9083c938ea128e04c4f98e6b18dd26d86dd2 (diff)
downloadPeerTube-ca00baa75ae849b1ba4953f0ff843ff5452f6745.tar.gz
PeerTube-ca00baa75ae849b1ba4953f0ff843ff5452f6745.tar.zst
PeerTube-ca00baa75ae849b1ba4953f0ff843ff5452f6745.zip
Avoid 404 when changing language
-rw-r--r--client/src/app/app-routing.module.ts19
1 files changed, 14 insertions, 5 deletions
diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts
index a39be17dc..d3cdcefea 100644
--- a/client/src/app/app-routing.module.ts
+++ b/client/src/app/app-routing.module.ts
@@ -1,10 +1,10 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router' 2import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router'
3import { AppComponent } from '@app/app.component'
4import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy' 3import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
5import { MenuGuards } from '@app/core/routing/menu-guard.service' 4import { MenuGuards } from '@app/core/routing/menu-guard.service'
6import { PreloadSelectedModulesList } from './core' 5import { PreloadSelectedModulesList } from './core'
7import { EmptyComponent } from './empty.component' 6import { EmptyComponent } from './empty.component'
7import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
8 8
9const routes: Routes = [ 9const routes: Routes = [
10 { 10 {
@@ -56,13 +56,22 @@ const routes: Routes = [
56 { 56 {
57 path: '', 57 path: '',
58 component: EmptyComponent // Avoid 404, app component will redirect dynamically 58 component: EmptyComponent // Avoid 404, app component will redirect dynamically
59 },
60 {
61 path: '**',
62 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
63 } 59 }
64] 60]
65 61
62// Avoid 404 when changing language
63for (const locale of POSSIBLE_LOCALES) {
64 routes.push({
65 path: locale,
66 component: EmptyComponent
67 })
68}
69
70routes.push({
71 path: '**',
72 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
73})
74
66@NgModule({ 75@NgModule({
67 imports: [ 76 imports: [
68 RouterModule.forRoot(routes, { 77 RouterModule.forRoot(routes, {