Skip to content

Commit

Permalink
fix: streamline withdrawal process by removing redundant loading stat…
Browse files Browse the repository at this point in the history
…e and ensuring modal closes after successful withdrawal
  • Loading branch information
mohandast52 committed Nov 21, 2024
1 parent 0ce491b commit e8265c3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frontend/components/YourWalletPage/WithdrawFunds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ export const WithdrawFunds = () => {
return;
}

setIsWithdrawalLoading(true);
message.loading('Withdrawal pending. It may take a few minutes.');

try {
setIsWithdrawalLoading(true);

const response = await ServicesService.withdrawBalance({
withdrawAddress: withdrawAddress as Address,
serviceHash: serviceHash,
Expand All @@ -68,13 +67,15 @@ export const WithdrawFunds = () => {

// refetch and keep up to date
await refetchDetails();

// Close modal after withdrawal is successful
handleCancel();
}
} catch (error) {
message.error('Failed to withdraw funds. Please try again.');
console.error(error);
} finally {
setIsWithdrawalLoading(false);
handleCancel(); // Close modal after withdrawal
}
}, [withdrawAddress, serviceHash, handleCancel, refetchDetails]);

Expand Down

0 comments on commit e8265c3

Please sign in to comment.