reset json on parsing error

This commit is contained in:
AykutSarac 2022-02-02 20:47:09 +03:00
parent 928bec9717
commit 6dec07736d

View File

@ -1,3 +1,5 @@
import { defaultValue } from "src/pages/editor/JsonEditor";
/**
* @param {never[] | Object} input
* @returns {import("react-flow-renderer").FlowElement[]}
@ -57,6 +59,7 @@ export const parser = (input) => {
return [...flatten(res), ...relationships(res)];
} catch (error) {
console.error("An error occured while parsin JSON data!", error.stack);
localStorage.setItem('json', JSON.stringify(defaultValue));
return Array;
}
};