fix(webui): don't send off 2 addXp requests at once #2815
@ -837,10 +837,9 @@ function updateInventory() {
|
||||
a.href = "#";
|
||||
a.onclick = function (event) {
|
||||
event.preventDefault();
|
||||
revalidateAuthz().then(() => {
|
||||
const promises = [];
|
||||
revalidateAuthz().then(async () => {
|
||||
if (item.XP < maxXP) {
|
||||
promises.push(addGearExp(category, item.ItemId.$oid, maxXP - item.XP));
|
||||
await addGearExp(category, item.ItemId.$oid, maxXP - item.XP);
|
||||
}
|
||||
if ("exalted" in itemMap[item.ItemType]) {
|
||||
for (const exaltedType of itemMap[item.ItemType].exalted) {
|
||||
@ -851,21 +850,17 @@ function updateInventory() {
|
||||
const exaltedCap =
|
||||
itemMap[exaltedType]?.type == "weapons" ? 800_000 : 1_600_000;
|
||||
if (exaltedItem.XP < exaltedCap) {
|
||||
promises.push(
|
||||
addGearExp(
|
||||
await addGearExp(
|
||||
"SpecialItems",
|
||||
exaltedItem.ItemId.$oid,
|
||||
exaltedCap - exaltedItem.XP
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Promise.all(promises).then(() => {
|
||||
updateInventory();
|
||||
});
|
||||
});
|
||||
};
|
||||
a.title = loc("code_maxRank");
|
||||
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.2V448c0 17.7 14.3 32 32 32s32-14.3 32-32V141.2L329.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/></svg>`;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user