mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-27 15:22:56 +08:00
reset json on parsing error
This commit is contained in:
parent
928bec9717
commit
6dec07736d
@ -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;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user