chore(webui): make add mods behave more like adding items
All checks were successful
Build / build (push) Successful in 48s
Build / build (pull_request) Successful in 1m26s

This commit is contained in:
Sainan 2025-04-19 02:37:30 +02:00
parent 8b0ba0b84a
commit 27c4b81a9e

View File

@ -1260,21 +1260,28 @@ function doAcquireMod() {
$("#mod-to-acquire").addClass("is-invalid").focus(); $("#mod-to-acquire").addClass("is-invalid").focus();
return; return;
} }
revalidateAuthz(() => { const count = parseInt($("#mod-count").val());
$.post({ if (count != 0) {
url: "/custom/addItems?" + window.authz, revalidateAuthz(() => {
contentType: "application/json", $.post({
data: JSON.stringify([ url: "/custom/addItems?" + window.authz,
{ contentType: "application/json",
ItemType: uniqueName, data: JSON.stringify([
ItemCount: parseInt($("#mod-count").val()) {
ItemType: uniqueName,
ItemCount: count
}
])
}).done(function () {
if (count > 0) {
toast(loc("code_succAdded"));
} else {
toast(loc("code_succRemoved"));
} }
]) updateInventory();
}).done(function () { });
document.getElementById("mod-to-acquire").value = "";
updateInventory();
}); });
}); }
} }
const uiConfigs = [...$("#server-settings input[id]")].map(x => x.id); const uiConfigs = [...$("#server-settings input[id]")].map(x => x.id);