Add try catch block if user reject a withdraw action
This commit is contained in:
parent
ec5fb7ef76
commit
94640c4492
@ -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
|
||||
|
@ -197,7 +197,7 @@ watch(walletAddress, (): void => {
|
||||
<SpinnerComponent
|
||||
width="4"
|
||||
height="4"
|
||||
color="blue-600"
|
||||
fillColor="white"
|
||||
></SpinnerComponent>
|
||||
</div>
|
||||
<div
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user