feat(webui): add "Remove" option for owned warframes & weapons (#172)

This commit is contained in:
Sainan 2024-05-06 21:49:49 +02:00 committed by GitHub
parent abe139151a
commit a8ea8d1364
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -83,6 +83,16 @@ function updateInventory() {
};
a.textContent = "Make Rank 30";
td.appendChild(a);
td.innerHTML += " · ";
}
{
const a = document.createElement("a");
a.href = "#";
a.onclick = function () {
disposeOfGear("Suits", item.ItemId.$oid);
};
a.textContent = "Remove";
td.appendChild(a);
}
tr.appendChild(td);
}
@ -109,6 +119,16 @@ function updateInventory() {
};
a.textContent = "Make Rank 30";
td.appendChild(a);
td.innerHTML += " · ";
}
{
const a = document.createElement("a");
a.href = "#";
a.onclick = function () {
disposeOfGear(category, item.ItemId.$oid);
};
a.textContent = "Remove";
td.appendChild(a);
}
tr.appendChild(td);
}
@ -197,3 +217,23 @@ function addGearExp(category, oid, xp) {
updateInventory();
});
}
function disposeOfGear(category, oid) {
const data = {
SellCurrency: "SC_RegularCredits",
SellPrice: 0,
Items: {}
};
data.Items[category] = [
{
String: oid
}
];
$.post({
url: "/api/sell.php?accountId=" + window.accountId,
contentType: "text/plain",
data: JSON.stringify(data)
}).done(function () {
updateInventory();
});
}