fix for local storage on governance
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
1052bced83
commit
a176a16aaf
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ghost-dao-interface",
|
||||
"private": true,
|
||||
"version": "0.5.22",
|
||||
"version": "0.5.23",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -43,7 +43,7 @@ const NewProposal = ({ config, address, connect, chainId }) => {
|
||||
|
||||
const theme = useTheme();
|
||||
|
||||
const myStoredProposals = localStorage.getItem(MY_PROPOSALS_PREFIX);
|
||||
const myStoredProposals = localStorage.getItem(`${MY_PROPOSALS_PREFIX}-${address}`);
|
||||
const [myProposals, setMyProposals] = useState(
|
||||
myStoredProposals ? JSON.parse(myStoredProposals).map(id => BigInt(id)) : []
|
||||
);
|
||||
@ -63,7 +63,7 @@ const NewProposal = ({ config, address, connect, chainId }) => {
|
||||
|
||||
useEffect(() => {
|
||||
const toStore = JSON.stringify(myProposals.map(id => id.toString()));
|
||||
localStorage.setItem(MY_PROPOSALS_PREFIX, toStore);
|
||||
localStorage.setItem(`${MY_PROPOSALS_PREFIX}-${address}`, toStore);
|
||||
}, [myProposals]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -168,8 +168,11 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
||||
const result = await castVote(chainId, address, proposalId, support);
|
||||
|
||||
if (result) {
|
||||
const toStore = JSON.stringify(proposalId.toString());
|
||||
localStorage.setItem(VOTED_PROPOSALS_PREFIX, toStore);
|
||||
const storedVotedProposals = localStorage.getItem(`${VOTED_PROPOSALS_PREFIX}-${address}`);
|
||||
const proposals = JSON.parse(storedVotedProposals || "[]").map(id => BigInt(id));
|
||||
proposals.push(proposalId);
|
||||
const toStore = JSON.stringify(proposals.map(id => id.toString()));
|
||||
localStorage.setItem(`${VOTED_PROPOSALS_PREFIX}-${address}`, toStore);
|
||||
}
|
||||
|
||||
setIsPending(true);
|
||||
|
||||
@ -52,12 +52,12 @@ const ProposalsList = ({ chainId, address, config }) => {
|
||||
|
||||
const [proposalsFilter, setProposalFilter] = useState("active");
|
||||
|
||||
const myStoredProposals = localStorage.getItem(MY_PROPOSALS_PREFIX);
|
||||
const myStoredProposals = localStorage.getItem(`${MY_PROPOSALS_PREFIX}-${address}`);
|
||||
const [myProposals, setMyProposals] = useState(
|
||||
myStoredProposals ? JSON.parse(myStoredProposals).map(id => BigInt(id)) : []
|
||||
);
|
||||
|
||||
const storedVotedProposals = localStorage.getItem(VOTED_PROPOSALS_PREFIX);
|
||||
const storedVotedProposals = localStorage.getItem(`${VOTED_PROPOSALS_PREFIX}-${address}`);
|
||||
const [votedProposals, setVotedProposals] = useState(
|
||||
storedVotedProposals ? JSON.parse(storedVotedProposals).map(id => BigInt(id)) : []
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user