Add alert to withdraw flow

This commit is contained in:
enzoggqs
2023-02-28 21:07:56 -03:00
parent e48f73354d
commit e4e6c32d64
3 changed files with 17 additions and 31 deletions

View File

@@ -6,15 +6,15 @@ const props = defineProps<{
const alertText = ref<string>("");
const alertPaddingLeft = ref<string>("18rem");
const alertPaddingTop = ref<string>("0rem");
if (props.type === "sell") {
alertPaddingLeft.value = "30%";
} else if (props.type === "buy") {
alertPaddingLeft.value = "30%";
} else if (props.type === "withdraw") {
alertPaddingLeft.value = "40%";
} else if (props.type === "redirect") {
alertPaddingLeft.value = "35%";
alertPaddingTop.value = "8rem";
}
switch (props.type) {
@@ -29,6 +29,9 @@ switch (props.type) {
case "redirect":
alertText.value = "Existe uma compra em aberto. Continuar?";
break;
case "withdraw":
alertText.value = "Tudo certo! Saque realizado com sucesso!";
break;
}
</script>
<template>
@@ -148,22 +151,4 @@ button {
border: 2px solid white;
margin-left: 1rem;
}
.lg-view {
display: inline-block;
}
.sm-view {
display: none;
}
@media screen and (max-width: 500px) {
.lg-view {
display: none;
}
.sm-view {
display: inline-block;
}
}
</style>

View File

@@ -59,19 +59,13 @@ const handleInputEvent = (event: any): void => {
enableConfirmButton.value = true;
};
const callWithdraw = async () => {
if (withdrawAmount.value) {
const withdraw = await withdrawDeposit(withdrawAmount.value);
if (withdraw) {
console.log(withdraw);
alert("Saque realizado!");
emit("depositWithdrawn");
}
}
const callWithdraw = () => {
emit("depositWithdrawn", withdrawAmount.value);
};
watch(withdrawAmount, (): void => {
if (!withdrawAmount.value) {
console.log(enableConfirmButton.value)
if (!withdrawAmount.value || !enableConfirmButton.value) {
withdrawButtonOpacity.value = 0.7;
withdrawButtonCursor.value = "not-allowed";
} else {
@@ -252,7 +246,6 @@ showInitialItems();
</h1>
<div
v-if="enableConfirmButton"
class="withdraw-button flex gap-2 items-center justify-self-center border-2 p-2 border-amber-300 rounded-md"
@click="callWithdraw"
>