Skip to content

Commit

Permalink
fix update ui after approval (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeither committed Jan 17, 2024
1 parent 40fce9c commit 5f48e3e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions webapp/src/components/BatchCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function BuyBatchButton({
// enabled: false,
args: [astaverdeContractConfig.address, parseUnits(totalPrice.toString(), 6)],
});
const { write: approve } = useContractWrite(configApprove);
const { writeAsync: approve } = useContractWrite(configApprove);

const { config: configBuyBatch } = usePrepareContractWrite({
...astaverdeContractConfig,
Expand All @@ -170,8 +170,11 @@ function BuyBatchButton({
<button
className="mt-4 bg-primary hover:bg-green-700 text-white font-bold py-2 px-4 rounded w-full"
disabled={!approve}
onClick={() => {
approve?.();
onClick={async () => {
if (approve) {
const result = await approve();
setAwaitedHash(result.hash);
}
}}
>
Approve USDC
Expand Down

1 comment on commit 5f48e3e

@vercel
Copy link

@vercel vercel bot commented on 5f48e3e Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

astaverde-dev – ./webapp

astaverde-dev-git-main-orpheuslummis.vercel.app
astaverde-dev-orpheuslummis.vercel.app
astaverde-dev.vercel.app

Please sign in to comment.