17143 adjsut switcher

This commit is contained in:
2025-06-18 10:17:26 +01:00
parent 56ad0c4843
commit 412f7d2e90
2 changed files with 44 additions and 27 deletions
+5 -2
View File
@@ -227,12 +227,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
preferredLocale = cookies.pedw_locale;
}
// Strip the current locale from the URL path
const pathWithoutLocale = ctx.resolvedUrl.replace(/^\/(cy|en)/, "");
//console.log("==============================", pathWithoutLocale);
if (preferredLocale !== locale) {
return {
redirect: {
destination: `/${preferredLocale}/myportal`,
destination: `/${preferredLocale}${pathWithoutLocale}`,
permanent: false,
locale: preferredLocale,
},
};
}