Require confirmation

This commit is contained in:
Sainan 2025-01-18 11:00:32 +01:00
parent 664e3cc9ca
commit c312814001

View File

@ -1093,25 +1093,30 @@ function doAddAllMods() {
} }
modsAll = Array.from(modsAll); modsAll = Array.from(modsAll);
// Batch to avoid PayloadTooLargeError if (
const batches = []; modsAll.length != 0 &&
for (let i = 0; i < modsAll.length; i += 1000) { window.confirm("Are you sure you want to add " + modsAll.length + " mods to your account?")
batches.push(modsAll.slice(i, i + 1000)); ) {
} // Batch to avoid PayloadTooLargeError
batches.forEach(batch => { const batches = [];
$.post({ for (let i = 0; i < modsAll.length; i += 1000) {
url: "/api/missionInventoryUpdate.php?" + window.authz, batches.push(modsAll.slice(i, i + 1000));
contentType: "text/plain", }
data: JSON.stringify({ batches.forEach(batch => {
RawUpgrades: batch.map(mod => ({ $.post({
ItemType: mod, url: "/api/missionInventoryUpdate.php?" + window.authz,
ItemCount: 21 // To fully upgrade certain arcanes contentType: "text/plain",
})) data: JSON.stringify({
}) RawUpgrades: batch.map(mod => ({
}).done(function () { ItemType: mod,
updateInventory(); ItemCount: 21 // To fully upgrade certain arcanes
}))
})
}).done(function () {
updateInventory();
});
}); });
}); }
}); });
}); });
} }