mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-27 15:22:56 +08:00
remove localstorage actions for json
This commit is contained in:
parent
4d50410e32
commit
8732e59024
@ -10,7 +10,6 @@ export const ClearModal: React.FC<ModalProps> = ({ visible, setVisible }) => {
|
|||||||
|
|
||||||
const handleClear = () => {
|
const handleClear = () => {
|
||||||
dispatch({ type: ConfigActionType.SET_JSON, payload: "{}" });
|
dispatch({ type: ConfigActionType.SET_JSON, payload: "{}" });
|
||||||
localStorage.removeItem("json");
|
|
||||||
toast.success(`Cleared JSON and removed from memory.`);
|
toast.success(`Cleared JSON and removed from memory.`);
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
};
|
};
|
||||||
|
@ -43,12 +43,8 @@ const WithConfig: ReactComponent = ({ children }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const jsonStored = localStorage.getItem("json");
|
|
||||||
if (jsonStored) {
|
|
||||||
dispatch({ type: ConfigActionType.SET_JSON, payload: jsonStored });
|
|
||||||
}
|
|
||||||
|
|
||||||
const configStored = localStorage.getItem("config");
|
const configStored = localStorage.getItem("config");
|
||||||
|
|
||||||
if (configStored) {
|
if (configStored) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ConfigActionType.SET_CONFIG,
|
type: ConfigActionType.SET_CONFIG,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user