mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 10:11:10 +00:00
Preserves the current URL as the return URL when language is changed
This commit is contained in:
1 parent
f43a8fd098
commit
8cbfb56389
3 files changed
+32
-22
No files matched your search
@@ -393,6 +393,7 @@ async function updateContentAsync(url, addToHistory) {
|
||||
const state = { url, content, title };
|
||||
history.pushState(state, title, url);
|
||||
}
|
||||
updateLanguageUrls();
|
||||
}
|
||||
} catch (error) {
|
||||
notificationService.show(jsLocalizedMessages.navigationFailed, NotificationType.ERROR);
|
||||
@@ -400,6 +401,15 @@ async function updateContentAsync(url, addToHistory) {
|
||||
}
|
||||
}
|
||||
|
||||
// Update language switcher links with the current URL
|
||||
function updateLanguageUrls() {
|
||||
document.querySelectorAll('a.lang-set').forEach(link => {
|
||||
const url = new URL(link.href);
|
||||
url.searchParams.set('returnUrl', window.location.pathname + window.location.search);
|
||||
link.href = url.toString();
|
||||
});
|
||||
}
|
||||
|
||||
//+======================================================================================+
|
||||
//| Common Helper Functions |
|
||||
//+======================================================================================+
|
||||
|
||||
Reference in new issue
Block a user