chore(webui): inform the user of JSON parsing errors during import
All checks were successful
Build / build (pull_request) Successful in 1m56s

This commit is contained in:
2025-11-05 16:52:42 +01:00
parent be064fd249
commit 34aa6f3698

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);
}
});
}