Skip to content

Commit

Permalink
minor fix PoolForm
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucianosc committed Oct 1, 2024
1 parent 77afbe6 commit ba9811a
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions apps/web/components/Forms/PoolForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ export function PoolForm({ token, communityAddr }: Props) {
setPreviewData(data);
setShowPreview(true);
};

const contractWrite = async (ipfsHash: string) => {
let spendingLimit: number;
let minimumConviction;
Expand Down Expand Up @@ -470,28 +469,32 @@ export function PoolForm({ token, communityAddr }: Props) {
>["args"],
) => {
try {
if (typeof previewData?.sybilResistanceValue !== "number") {
throw new Error("Gitcoin pasport value is not number");
if (
typeof previewData?.sybilResistanceValue === "number" ||
typeof previewData?.sybilResistanceValue === "string"
) {
const res = await fetch("/api/passport-oracle/addStrategy", {
method: "POST",
body: JSON.stringify({
strategy: newPoolData._strategy,
threshold:
(previewData?.sybilResistanceValue ?? 0) * CV_PERCENTAGE_SCALE,
}),
headers: {
"Content-Type": "application/json",
},
});
console.debug(res);
setLoading(false);
router.push(
pathname?.replace(
"/create-pool",
`?${QUERY_PARAMS.communityPage.newPool}=${newPoolData._poolId.toString()}`,
),
);
} else {
throw new Error("Gitcoin pasport value is not number or string");
}
const res = await fetch("/api/passport-oracle/addStrategy", {
method: "POST",
body: JSON.stringify({
strategy: newPoolData._strategy,
threshold:
(previewData?.sybilResistanceValue ?? 0) * CV_PERCENTAGE_SCALE,
}),
headers: {
"Content-Type": "application/json",
},
});
console.debug(res);
setLoading(false);
router.push(
pathname?.replace(
"/create-pool",
`?${QUERY_PARAMS.communityPage.newPool}=${newPoolData._poolId.toString()}`,
),
);
} catch (error) {
console.error(error);
setLoading(false);
Expand Down

0 comments on commit ba9811a

Please sign in to comment.