Skip to content

Commit ca7cd26

Browse files
authored
Read from local storage when loading
1 parent fc1537f commit ca7cd26

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/app/features/main/Main.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from "react";
2+
import { useEffect } from "react";
23
import styled from "styled-components";
34
import { Fieldset, Panel } from "react95";
45

@@ -39,9 +40,15 @@ const FooterPanel = styled(Panel)`
3940
`;
4041

4142
const Main = () => {
42-
const { selectedContract: contract } = Contracts.useContainer();
43-
useQueryStringContract()
44-
43+
const { selectedContract: contract, overwriteContract } =
44+
Contracts.useContainer();
45+
useQueryStringContract();
46+
useEffect(() => {
47+
let result = localStorage.getItem("contracts");
48+
result = `{"data":${result}}`;
49+
let jsonResult = JSON.parse(result).data;
50+
overwriteContract(jsonResult);
51+
}, [contract]);
4552
return (
4653
<Container>
4754
<ContentFrame label={contract && contract.name}>

0 commit comments

Comments
 (0)