chore(webui): make add mods behave more like adding items #1732

Merged
Sainan merged 1 commits from webui-mods into main 2025-04-19 09:05:56 -07:00

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);