chore(webui): inform the user of JSON parsing errors during import (#3001)
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:
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user