Skip to content

Commit

Permalink
refactor: simplify language change URL handling and remove unnecessar…
Browse files Browse the repository at this point in the history
…y timeout
  • Loading branch information
omdxp committed Dec 31, 2024
1 parent 04552e1 commit c13d798
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions web/src/redux/actions/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ export const changeLanguage = (languageCode: Language["code"]) => {

// remove code from url if it's the default language
if (language.code === Languages[0].code) {
newPath = newPath.replace(new RegExp(`^/${language.code}`), "");
newPath = newPath.replace(new RegExp(`^/${language.code}`), "") || "/";
}

setTimeout(() => {
window.location.href = newPath;
}, 300);
window.location.href = newPath;
};

0 comments on commit c13d798

Please sign in to comment.