From ce6aced7391cd10e04ff80c22cda0d10605573a5 Mon Sep 17 00:00:00 2001 From: enzoggqs Date: Mon, 12 Dec 2022 14:29:58 -0300 Subject: [PATCH] Change var isPixValid to bool instead of number --- src/components/QrCodeComponent.vue | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/QrCodeComponent.vue b/src/components/QrCodeComponent.vue index 470ade8..8fcdd9f 100644 --- a/src/components/QrCodeComponent.vue +++ b/src/components/QrCodeComponent.vue @@ -16,7 +16,8 @@ const pixQrCode = pix({ pixKey: props.pixTarget ?? "", value: props.tokenValue, }); -const isPixValid = ref(0); +const isPixValid = ref(false); +const isCodeInputEmpty = ref(true); pixQrCode.base64QrCode().then((code: string) => { qrCode.value = code; @@ -34,7 +35,8 @@ const handleInputEvent = (event: any) => { const validatePix = async (e2eid: any) => { if(e2eid == ''){ - isPixValid.value = 0; + isPixValid.value = false; + isCodeInputEmpty.value = true; return; } var sellerPixKey = props.pixTarget; @@ -49,15 +51,18 @@ const validatePix = async (e2eid: any) => { var resp = await api.post("http://localhost:8000/validate_pix", body_req) .catch((reason: Error) => { console.log('entrou no erro', reason); - isPixValid.value = 2; + isPixValid.value = false; + isCodeInputEmpty.value = false; return; }); console.log("🚀 ~ file: QrCodeForm.vue:47 ~ validatePix ~ resp", resp); console.log(resp.status); - isPixValid.value = 1; + isCodeInputEmpty.value = false; + isPixValid.value = true; } else { - isPixValid.value = 0; + isCodeInputEmpty.value = false; + isPixValid.value = false; } }; @@ -107,8 +112,8 @@ const validatePix = async (e2eid: any) => { @input="debounce(handleInputEvent, 500)($event)" class="text-md w-full box-border p-2 h-6 mb-2 outline-none" /> -
-
+
+
Invalid Icon { >
-
+
Valid Icon {