chore(webui): force account cheat element state after request is done (#2862)
There's a very slim chance we get an inventory response between sending the setAccountCheat request and receiving the response, in which case the element state would be ingruent. Reviewed-on: OpenWF/SpaceNinjaServer#2862 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:
parent
6022bf97b5
commit
43bc12713a
@ -3195,13 +3195,16 @@ function doIntrinsicsUnlockAll() {
|
|||||||
document.querySelectorAll("#account-cheats input[type=checkbox]").forEach(elm => {
|
document.querySelectorAll("#account-cheats input[type=checkbox]").forEach(elm => {
|
||||||
elm.onchange = function () {
|
elm.onchange = function () {
|
||||||
revalidateAuthz().then(() => {
|
revalidateAuthz().then(() => {
|
||||||
|
const value = elm.checked;
|
||||||
$.post({
|
$.post({
|
||||||
url: "/custom/setAccountCheat?" + window.authz,
|
url: "/custom/setAccountCheat?" + window.authz,
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
key: elm.id,
|
key: elm.id,
|
||||||
value: elm.checked
|
value: value
|
||||||
})
|
})
|
||||||
|
}).done(() => {
|
||||||
|
elm.checked = value;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -3237,6 +3240,8 @@ document.querySelectorAll("#account-cheats .input-group").forEach(grp => {
|
|||||||
key: input.id,
|
key: input.id,
|
||||||
value: parseInt(value)
|
value: parseInt(value)
|
||||||
})
|
})
|
||||||
|
}).done(() => {
|
||||||
|
btn.value = value;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user