chore(webui): inform the user of JSON parsing errors during import (#3001)
All checks were successful
Build / build (push) Successful in 1m18s
Build Docker image / docker (push) Successful in 3m1s

Closes #2996

Reviewed-on: https://www.onlyg.it/OpenWF/SpaceNinjaServer/pulls/3001
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit was merged in pull request #3001.
This commit is contained in:
2025-11-05 07:58:25 -08:00
committed by Sainan
parent be064fd249
commit 65138b64fc

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