chore(webui): assume deleting items will always succeed (#1731)
Some checks failed
Build Docker image / docker (push) Has been cancelled
Build / build (push) Has been cancelled

instead of waiting for a response + then refreshing inventory, we can just delete the element right away and hope it works out

Reviewed-on: #1731
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-19 09:05:43 -07:00 committed by Sainan
parent c1ca303310
commit e59bdcdfbc

View File

@ -487,6 +487,7 @@ function updateInventory() {
a.href = "#"; a.href = "#";
a.onclick = function (event) { a.onclick = function (event) {
event.preventDefault(); event.preventDefault();
document.getElementById(category + "-list").removeChild(tr);
disposeOfGear(category, item.ItemId.$oid); disposeOfGear(category, item.ItemId.$oid);
}; };
a.title = loc("code_remove"); a.title = loc("code_remove");
@ -683,6 +684,7 @@ function updateInventory() {
a.href = "#"; a.href = "#";
a.onclick = function (event) { a.onclick = function (event) {
event.preventDefault(); event.preventDefault();
document.getElementById("riven-list").removeChild(tr);
disposeOfGear("Upgrades", item.ItemId.$oid); disposeOfGear("Upgrades", item.ItemId.$oid);
}; };
a.title = loc("code_remove"); a.title = loc("code_remove");
@ -723,6 +725,7 @@ function updateInventory() {
a.href = "#"; a.href = "#";
a.onclick = function (event) { a.onclick = function (event) {
event.preventDefault(); event.preventDefault();
document.getElementById("mods-list").removeChild(tr);
disposeOfGear("Upgrades", item.ItemId.$oid); disposeOfGear("Upgrades", item.ItemId.$oid);
}; };
a.title = loc("code_remove"); a.title = loc("code_remove");
@ -765,6 +768,7 @@ function updateInventory() {
a.href = "#"; a.href = "#";
a.onclick = function (event) { a.onclick = function (event) {
event.preventDefault(); event.preventDefault();
document.getElementById("mods-list").removeChild(tr);
disposeOfItems("Upgrades", item.ItemType, item.ItemCount); disposeOfItems("Upgrades", item.ItemType, item.ItemCount);
}; };
a.title = loc("code_remove"); a.title = loc("code_remove");
@ -1097,8 +1101,6 @@ function disposeOfGear(category, oid) {
url: "/api/sell.php?" + window.authz, url: "/api/sell.php?" + window.authz,
contentType: "text/plain", contentType: "text/plain",
data: JSON.stringify(data) data: JSON.stringify(data)
}).done(function () {
updateInventory();
}); });
}); });
} }
@ -1120,8 +1122,6 @@ function disposeOfItems(category, type, count) {
url: "/api/sell.php?" + window.authz, url: "/api/sell.php?" + window.authz,
contentType: "text/plain", contentType: "text/plain",
data: JSON.stringify(data) data: JSON.stringify(data)
}).done(function () {
updateInventory();
}); });
}); });
} }