chore(webui): make add mods behave more like adding items (#1732)
Reviewed-on: #1732 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
e59bdcdfbc
commit
26f37f58e5
@ -1260,6 +1260,8 @@ function doAcquireMod() {
|
||||
$("#mod-to-acquire").addClass("is-invalid").focus();
|
||||
return;
|
||||
}
|
||||
const count = parseInt($("#mod-count").val());
|
||||
if (count != 0) {
|
||||
revalidateAuthz(() => {
|
||||
$.post({
|
||||
url: "/custom/addItems?" + window.authz,
|
||||
@ -1267,15 +1269,20 @@ function doAcquireMod() {
|
||||
data: JSON.stringify([
|
||||
{
|
||||
ItemType: uniqueName,
|
||||
ItemCount: parseInt($("#mod-count").val())
|
||||
ItemCount: count
|
||||
}
|
||||
])
|
||||
}).done(function () {
|
||||
document.getElementById("mod-to-acquire").value = "";
|
||||
if (count > 0) {
|
||||
toast(loc("code_succAdded"));
|
||||
} else {
|
||||
toast(loc("code_succRemoved"));
|
||||
}
|
||||
updateInventory();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const uiConfigs = [...$("#server-settings input[id]")].map(x => x.id);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user