diff --git a/dapp/src/components/page/proposal/VotingModal.tsx b/dapp/src/components/page/proposal/VotingModal.tsx index 588e57d..c1d966c 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 691b26a..0942b97 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("");