Skip to content

Commit

Permalink
feat(transaction): 트랜잭션 타이밍 세밀화
Browse files Browse the repository at this point in the history
  • Loading branch information
Me1e committed Aug 1, 2023
1 parent 7b97db4 commit 83478d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/nextjs/components/Writer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function Writer({ contractName, functionName, args, text }: any)

useEffect(() => {
if (isSuccess === true) {
alert("Fact Checked! It will be reflected in a moment.");
alert("Succeed! It will be reflected in a moment.");
}
}, [isSuccess]);

Expand Down
11 changes: 9 additions & 2 deletions packages/nextjs/pages/report/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function CreateNFTWhenContractExist() {
setType(e.target.value);
}

const { writeAsync } = useScaffoldContractWrite({
const { writeAsync, isSuccess } = useScaffoldContractWrite({
contractName: "ERC721Token",
functionName: "mintNFT",
// For payable functions, expressed in ETH
Expand Down Expand Up @@ -124,7 +124,7 @@ function CreateNFTWhenContractExist() {
const cid = await handleIpfs();
console.log("write start");
await writeAsync({ args: [address, cid, 0] });
router.push("/");
// router.push("/");
}

async function handleIpfs() {
Expand All @@ -149,6 +149,13 @@ function CreateNFTWhenContractExist() {
return tokenURL;
}

useEffect(() => {
if (isSuccess) {
alert("Succeed! It will be reflected in a moment.");
router.push("/");
}
}, [isSuccess, router]);

useEffect(() => {
const { geolocation } = navigator;

Expand Down

0 comments on commit 83478d2

Please sign in to comment.