From 7fde5bf8c1a1e645f19e05f92f8d1912668d4057 Mon Sep 17 00:00:00 2001 From: Alexandre Hajjar Date: Sat, 15 May 2021 19:03:43 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Make=20Switch=20to=20English=20work?= =?UTF-8?q?=20in=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes an e2e test that was failing when in development. --- .../source/components/layout/Footer/Footer.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mon-entreprise/source/components/layout/Footer/Footer.tsx b/mon-entreprise/source/components/layout/Footer/Footer.tsx index 1cd0da9b1..49727e297 100644 --- a/mon-entreprise/source/components/layout/Footer/Footer.tsx +++ b/mon-entreprise/source/components/layout/Footer/Footer.tsx @@ -39,14 +39,16 @@ export default function Footer() { const sitePaths = useContext(SitePathsContext) const showFeedback = useShowFeedback() const language = useTranslation().i18n.language as 'fr' | 'en' - const hrefLink = - hrefLangLink[language][ - decodeURIComponent( - (process.env.NODE_ENV === 'production' - ? window.location.protocol + '//' + window.location.host - : '') + window.location.pathname - ).replace(/\/$/, '') - ] || [] + + const encodedUri = + (process.env.NODE_ENV === 'production' || + process.env.NODE_ENV === 'development' + ? window.location.protocol + '//' + window.location.host + : '') + window.location.pathname + const uri = decodeURIComponent(encodedUri).replace(/\/$/, '') + + const hrefLink = hrefLangLink[language][uri] || [] + return (