Fix: Error after logging out and selecting another language (#924)

Fix exception url after logout
This commit is contained in:
Ludy
2024-03-17 10:57:17 +01:00
committed by GitHub
parent f474651f36
commit 51bb26ae34
2 changed files with 8 additions and 4 deletions

View File

@@ -47,8 +47,10 @@ function handleDropdownItemClick(event) {
localStorage.setItem("languageCode", languageCode);
const currentUrl = window.location.href;
if (currentUrl.indexOf("?lang=") === -1) {
if (currentUrl.indexOf("?lang=") === -1 && currentUrl.indexOf("&lang=") === -1) {
window.location.href = currentUrl + "?lang=" + languageCode;
} else if (currentUrl.indexOf("&lang=") !== -1 && currentUrl.indexOf("?lang=") === -1) {
window.location.href = currentUrl.replace(/&lang=\w{2,}/, "&lang=" + languageCode);
} else {
window.location.href = currentUrl.replace(/\?lang=\w{2,}/, "?lang=" + languageCode);
}