Skip to content

Commit

Permalink
dumb fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrohasf committed Feb 28, 2025
1 parent 2fd006e commit 4cc382c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/app/proposals/[proposal_id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,14 @@ export async function generateMetadata({
80
);

const voter = searchParams.voter as string;
const newVote = searchParams.newVote as string;
const voterSearchParams = searchParams.voter as string;

const voter = voterSearchParams
? voterSearchParams?.split("newVote=")[0]
: null;
const newVote = voterSearchParams
? voterSearchParams?.split("newVote=")[1]
: null;
const newVoteParsed = newVote
? JSON.parse(decodeURIComponent(newVote))
: undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export function ApprovalCastVoteDialog({
voteDate: null,
supportType: abstain ? "ABSTAIN" : "FOR",
voteReason: reason || "",
proposalLink: `${window.location.origin}/proposals/${proposal.id}?voter=${address}&newVote=${encodeURIComponent(
proposalLink: `${window.location.origin}/proposals/${proposal.id}?voter=${address}newVote=${encodeURIComponent(
JSON.stringify(newVote)
)}`,
proposalTitle: proposal.markdowntitle,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Votes/CastVoteInput/CastVoteContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const CastVoteContextProvider = ({
voteDate: null,
supportType: support || "ABSTAIN",
voteReason: reason || "",
proposalLink: `${window.location.origin}/proposals/${proposal.id}?voter=${address}&newVote=${encodeURIComponent(
proposalLink: `${window.location.origin}/proposals/${proposal.id}?voter=${address}newVote=${encodeURIComponent(
JSON.stringify(newVote)
)}`,
proposalTitle: proposal.markdowntitle,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Votes/CastVoteInput/CastVoteInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ export function SuccessMessage({
: "",
supportType: support || "ABSTAIN",
voteReason: reason || "",
proposalLink: `${window.location.origin}/proposals/${proposal.id}?voter=${address}&newVote=${encodeURIComponent(
proposalLink: `${window.location.origin}/proposals/${proposal.id}?voter=${address}newVote=${encodeURIComponent(
JSON.stringify(newVote)
)}`,
proposalTitle: proposal.markdowntitle,
Expand Down

0 comments on commit 4cc382c

Please sign in to comment.