chore(webui): inform the user of JSON parsing errors during import #3001

Merged
Sainan merged 1 commits from import-catch into main 2025-11-05 07:58:26 -08:00

View File

@@ -3552,16 +3552,21 @@ function doPopArchonCrystalUpgrade(type) {
function doImport() {
revalidateAuthz().then(() => {
$.post({
url: "/custom/import?" + window.authz,
contentType: "application/json",
data: JSON.stringify({
inventory: JSON.parse($("#import-inventory").val())
})
}).then(function () {
toast(loc("code_succImport"));
updateInventory();
});
try {
$.post({
url: "/custom/import?" + window.authz,
contentType: "application/json",
data: JSON.stringify({
inventory: JSON.parse($("#import-inventory").val())
})
}).then(function () {
toast(loc("code_succImport"));
updateInventory();
});
} catch (e) {
toast(e);
console.error(e);
}
});
}