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

userpage: hide bg on login, dont refresh page ever

This commit is contained in:
Harvey Tindall 2023-06-21 17:02:57 +01:00
parent 757c3a8aed
commit 4e7f720214
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
2 changed files with 7 additions and 6 deletions

View File

@ -69,7 +69,7 @@
<span class="button ~warning" alt="{{ .strings.theme }}" id="button-theme"><i class="ri-sun-line"></i></span>
<span class="button ~critical @low mb-4 unfocused" id="logout-button">{{ .strings.logout }}</span>
</div>
<div class="page-container">
<div class="page-container unfocused">
<div class="card @low dark:~d_neutral mb-4" id="card-user">
<span class="heading mb-2"></span>
</div>

View File

@ -175,7 +175,7 @@ class ContactMethods {
const deleteButton = row.querySelector(".user-contact-delete") as HTMLButtonElement;
deleteButton.onclick = () => _delete("/my/" + name, null, (req: XMLHttpRequest) => {
if (req.readyState != 4) return;
window.location.reload();
document.dispatchEvent(new CustomEvent("details-reload"));
});
}
@ -289,7 +289,7 @@ const addEditEmail = (add: boolean): void => {
toggleLoader(submit);
_post("/my/email", {"email": input.value}, (req: XMLHttpRequest) => {
if (req.readyState == 4 && (req.status == 303 || req.status == 200)) {
window.location.reload();
document.dispatchEvent(new CustomEvent("details-reload"));
}
}, true, (req: XMLHttpRequest) => {
if (req.readyState == 4 && req.status == 401) {
@ -312,7 +312,7 @@ const discordConf: ServiceConfiguration = {
accountLinkedError: window.lang.notif("errorAccountLinked"),
successError: window.lang.notif("verified"),
successFunc: (modalClosed: boolean) => {
if (modalClosed) window.location.reload();
if (modalClosed) document.dispatchEvent(new CustomEvent("details-reload"));
}
};
@ -327,7 +327,7 @@ const telegramConf: ServiceConfiguration = {
accountLinkedError: window.lang.notif("errorAccountLinked"),
successError: window.lang.notif("verified"),
successFunc: (modalClosed: boolean) => {
if (modalClosed) window.location.reload();
if (modalClosed) document.dispatchEvent(new CustomEvent("details-reload"));
}
};
@ -342,7 +342,7 @@ const matrixConf: MatrixConfiguration = {
unknownError: window.lang.notif("errorUnknown"),
successError: window.lang.notif("verified"),
successFunc: () => {
setTimeout(() => window.location.reload(), 1200);
setTimeout(() => document.dispatchEvent(new CustomEvent("details-reload")), 1200);
}
};
@ -431,6 +431,7 @@ document.addEventListener("details-reload", () => {
const login = new Login(window.modals.login as Modal, "/my/");
login.onLogin = () => {
console.log("Logged in.");
document.querySelector(".page-container").classList.remove("unfocused");
document.dispatchEvent(new CustomEvent("details-reload"));
};