Skip to content

Commit

Permalink
Add routes with prefix path
Browse files Browse the repository at this point in the history
This is necessary for component properties to work correctly in SSR,
when we use prefix
  • Loading branch information
wesleybl committed Mar 15, 2024
1 parent 9a6b25f commit 149c899
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/volto/src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function getExternalRoutes() {
);
}

export const defaultRoutes = [
const baseRoutes = [
// redirect to external links if path is in blacklist
...getExternalRoutes(),
...((config.settings?.isMultilingual && multilingualRoutes) || []),
Expand Down Expand Up @@ -313,6 +313,9 @@ export const defaultRoutes = [
component: PersonalInformation,
exact: true,
},
];

const fallbackRoutes = [
{
path: '/**',
component: View,
Expand All @@ -323,6 +326,20 @@ export const defaultRoutes = [
},
];

let prefixRoutes = [];
if (config.settings.prefixPath) {
prefixRoutes = baseRoutes.map((route) => ({
...route,
path: `${config.settings.prefixPath}${route['path']}`,
}));
}

export const defaultRoutes = [
...baseRoutes,
...prefixRoutes,
...fallbackRoutes,
];

/**
* Routes array.
* @array
Expand Down

0 comments on commit 149c899

Please sign in to comment.