From cd168ea2f629a04a1aa0b715c40611cd24a5e83d Mon Sep 17 00:00:00 2001 From: 0xExp-po Date: Tue, 17 Dec 2024 22:14:10 +0900 Subject: [PATCH] fix: proposal Id store variable data type --- dapp/src/components/page/proposal/VotingModal.tsx | 6 +++++- dapp/src/utils/store.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dapp/src/components/page/proposal/VotingModal.tsx b/dapp/src/components/page/proposal/VotingModal.tsx index 588e57d0..c1d966cb 100644 --- a/dapp/src/components/page/proposal/VotingModal.tsx +++ b/dapp/src/components/page/proposal/VotingModal.tsx @@ -4,7 +4,7 @@ import type { VoteType } from "types/proposal"; interface VotersModalProps { projectName: string; - proposalId: number; + proposalId: number | undefined; isVoted: boolean; setIsVoted: React.Dispatch>; onClose: () => void; @@ -34,6 +34,10 @@ const VotingModal: React.FC = ({ setIsLoading(true); const { voteToProposal } = await import("@service/WriteContractService"); + if (proposalId === undefined) { + alert("Proposal ID is required"); + return; + } const res = await voteToProposal(projectName, proposalId, selectedOption); if (res.data) { diff --git a/dapp/src/utils/store.js b/dapp/src/utils/store.js index 691b26aa..0942b974 100644 --- a/dapp/src/utils/store.js +++ b/dapp/src/utils/store.js @@ -4,5 +4,5 @@ export const projectInfoLoaded = atom(false); export const latestCommit = atom(""); export const projectCardModalOpen = atom(false); export const projectNameForGovernance = atom(""); -export const proposalId = atom(0); +export const proposalId = atom(undefined); export const connectedPublicKey = atom("");