Skip to content

Commit 56bc9ec

Browse files
committed
correct redirect
1 parent 7850cac commit 56bc9ec

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/components/Language/Language.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import i18n from '../../i18n';
33
//import { useTranslation } from 'react-i18next';
4-
import { redirect } from 'react-router-dom';
4+
import { redirect, redirectDocument, replace } from 'react-router-dom';
55

66
import "./Language.scss";
77

@@ -20,14 +20,13 @@ const Language: React.FC<LanguageProps> = ({ changeLanguage }) => {
2020

2121
const currentPath = window.location.href;
2222
let newUrl = '';
23-
23+
2424
if (lng === 'en') {
25-
newUrl = currentPath.replace('\.fr', '\.com');
25+
newUrl = currentPath.replace('\.fr', '.com');
2626
} else {
27-
newUrl = currentPath.replace('\.com', '\.fr');
27+
newUrl = currentPath.replace('\.com', '.fr');
2828
}
29-
30-
redirect(newUrl);
29+
window.location.href = newUrl;
3130
};
3231

3332
return (

0 commit comments

Comments
 (0)