keep language choice in url when changing tabs

pull/36/head v0.2.8
Harvey Tindall 4 years ago
parent ffc62574ec
commit e68dccbc17
No known key found for this signature in database
GPG Key ID: BBC65952848FB1A2

@ -94,12 +94,17 @@ if (window.location.pathname == "/") {
} }
document.addEventListener("tab-change", (event: CustomEvent) => { document.addEventListener("tab-change", (event: CustomEvent) => {
const urlParams = new URLSearchParams(window.location.search);
const lang = urlParams.get('lang');
let tab = "/" + event.detail; let tab = "/" + event.detail;
if (tab == "/invites") { if (tab == "/invites") {
if (window.location.pathname == "/") { if (window.location.pathname == "/") {
tab = "/"; tab = "/";
} else { tab = "../"; } } else { tab = "../"; }
} }
if (lang) {
tab += "?lang=" + lang
}
window.history.replaceState("", "Admin - jfa-go", tab); window.history.replaceState("", "Admin - jfa-go", tab);
}); });

Loading…
Cancel
Save