Make Switch to English work in development

This fixes an e2e test that was failing when in development.
pull/1569/head
Alexandre Hajjar 2021-05-15 19:03:43 +02:00
parent f1afa5a3c3
commit 7fde5bf8c1
1 changed files with 10 additions and 8 deletions

View File

@ -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 (
<div className="footer-container">
<Helmet>