Merge pull request 'fix(front-end): fix security' (#39) from dev into main
Reviewed-on: #39
This commit was merged in pull request #39.
This commit is contained in:
@@ -1,4 +1,13 @@
|
|||||||
import { Routes } from '@angular/router';
|
import { CanMatchFn, Routes } from '@angular/router';
|
||||||
|
|
||||||
|
const SUPPORTED_LANGS = new Set(['it', 'en', 'de', 'fr']);
|
||||||
|
|
||||||
|
const langPrefixCanMatch: CanMatchFn = (_route, segments) => {
|
||||||
|
if (segments.length === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return SUPPORTED_LANGS.has(segments[0].path.toLowerCase());
|
||||||
|
};
|
||||||
|
|
||||||
const appChildRoutes: Routes = [
|
const appChildRoutes: Routes = [
|
||||||
{
|
{
|
||||||
@@ -116,6 +125,7 @@ const appChildRoutes: Routes = [
|
|||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: ':lang',
|
path: ':lang',
|
||||||
|
canMatch: [langPrefixCanMatch],
|
||||||
loadComponent: () =>
|
loadComponent: () =>
|
||||||
import('./core/layout/layout.component').then((m) => m.LayoutComponent),
|
import('./core/layout/layout.component').then((m) => m.LayoutComponent),
|
||||||
children: appChildRoutes,
|
children: appChildRoutes,
|
||||||
|
|||||||
Reference in New Issue
Block a user