mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2024-11-16 12:20:12 +01:00
Fix: Error after logging out and selecting another language (#924)
Fix exception url after logout
This commit is contained in:
parent
f474651f36
commit
51bb26ae34
@ -47,8 +47,10 @@ function handleDropdownItemClick(event) {
|
|||||||
localStorage.setItem("languageCode", languageCode);
|
localStorage.setItem("languageCode", languageCode);
|
||||||
|
|
||||||
const currentUrl = window.location.href;
|
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;
|
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 {
|
} else {
|
||||||
window.location.href = currentUrl.replace(/\?lang=\w{2,}/, "?lang=" + languageCode);
|
window.location.href = currentUrl.replace(/\?lang=\w{2,}/, "?lang=" + languageCode);
|
||||||
}
|
}
|
||||||
|
@ -118,10 +118,12 @@
|
|||||||
console.log("currentLang", currentLang)
|
console.log("currentLang", currentLang)
|
||||||
console.log("languageCode", languageCode)
|
console.log("languageCode", languageCode)
|
||||||
const currentUrl = window.location.href;
|
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;
|
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 {
|
} else {
|
||||||
window.location.href = currentUrl.replace(/\?lang=\w{2,}/, '?lang=' + languageCode);
|
window.location.href = currentUrl.replace(/\?lang=\w{2,}/, "?lang=" + languageCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dropdown.innerHTML = event.currentTarget.innerHTML; // Update the dropdown button's content
|
dropdown.innerHTML = event.currentTarget.innerHTML; // Update the dropdown button's content
|
||||||
|
Loading…
Reference in New Issue
Block a user