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

@ -112,7 +112,7 @@ showInitialItems();
<template>
<div class="blur-container" v-if="loadingWalletTransactions">
<SpinnerComponent width="8" height="8" color="white"></SpinnerComponent>
<SpinnerComponent width="8" height="8" fillColor="white"></SpinnerComponent>
</div>
<div class="blur-container" v-if="!loadingWalletTransactions">
<div

View File

@ -197,7 +197,7 @@ watch(walletAddress, (): void => {
<SpinnerComponent
width="4"
height="4"
color="blue-600"
fillColor="white"
></SpinnerComponent>
</div>
<div

View File

@ -3,7 +3,7 @@
const props = defineProps({
width: String,
height: String,
color: String,
fillColor: String,
show: Boolean,
});
@ -11,7 +11,7 @@ const getCustomClass = () => {
return [
`w-${props.width}`,
`h-${props.height}`,
`fill-${props.color}`,
`fill-${props.fillColor}`,
"text-gray-200",
"animate-spin",
"dark:text-gray-600",

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;
}
};