Add try catch block if user reject a withdraw action

This commit is contained in:
RcleydsonR
2023-02-17 18:06:58 -03:00
parent ec5fb7ef76
commit 94640c4492
4 changed files with 12 additions and 7 deletions

View File

@@ -23,15 +23,20 @@ const transactionsList = ref<WalletTransaction[]>([]);
const callWithdraw = async (amount: string) => {
if (amount) {
loadingWithdraw.value = true;
const withdraw = await withdrawDeposit(amount);
let withdraw;
try {
withdraw = await withdrawDeposit(amount);
} catch {
loadingWithdraw.value = false;
}
if (withdraw) {
console.log("Saque realizado!");
await getWalletTransactions();
loadingWithdraw.value = false;
} else {
console.log("Não foi possível realizar o saque!");
loadingWithdraw.value = false;
}
loadingWithdraw.value = false;
}
};