fix(webui): handle config get request failing due to expired authz (#1716)
Some checks failed
Build / build (push) Has been cancelled
Build Docker image / docker (push) Has been cancelled

Reviewed-on: #1716
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-04-18 11:17:55 -07:00 committed by Sainan
parent bc5dc02fc9
commit 6394adb0f0

View File

@ -1315,7 +1315,7 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
interval = setInterval(() => {
if (window.authz) {
clearInterval(interval);
fetch("/custom/config?" + window.authz).then(res => {
fetch("/custom/config?" + window.authz).then(async res => {
if (res.status == 200) {
$("#server-settings-no-perms").addClass("d-none");
$("#server-settings").removeClass("d-none");
@ -1335,8 +1335,16 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
})
);
} else {
$("#server-settings-no-perms").removeClass("d-none");
$("#server-settings").addClass("d-none");
if ((await res.text()) == "Log-in expired") {
revalidateAuthz(() => {
if (single.getCurrentPath() == "/webui/cheats") {
single.loadRoute("/webui/cheats");
}
});
} else {
$("#server-settings-no-perms").removeClass("d-none");
$("#server-settings").addClass("d-none");
}
}
});
}