1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

keep language choice in url when changing tabs

This commit is contained in:
Harvey Tindall 2021-01-15 21:16:11 +00:00
parent ffc62574ec
commit e68dccbc17
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2

View File

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