From 3e770d0a087e2aa6366a8e6a4682bc727e4d658e Mon Sep 17 00:00:00 2001 From: enzoggqs Date: Mon, 12 Dec 2022 14:20:17 -0300 Subject: [PATCH] Improve code quality --- src/components/QrCodeForm.vue | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/components/QrCodeForm.vue b/src/components/QrCodeForm.vue index efca314..290df10 100644 --- a/src/components/QrCodeForm.vue +++ b/src/components/QrCodeForm.vue @@ -10,16 +10,13 @@ const props = defineProps({ tokenValue: Number, }); -console.log(props.tokenValue); -console.log(props.pixTarget); - const qrCode = ref(""); const qrCodePayload = ref(""); const pixQrCode = pix({ pixKey: props.pixTarget ?? "", value: props.tokenValue, }); -const pixIsValid = ref(0); +const isPixValid = ref(0); pixQrCode.base64QrCode().then((code: string) => { qrCode.value = code; @@ -33,10 +30,9 @@ const handleInputEvent = (event: any) => { validatePix(value); }; -const validatePix = async (value: any) => { - console.log(value); - if(value == ''){ - pixIsValid.value = 0; +const validatePix = async (e2eid: any) => { + if(e2eid == ''){ + isPixValid.value = 0; return; } var sellerPixKey = props.pixTarget; @@ -44,22 +40,22 @@ const validatePix = async (value: any) => { if(sellerPixKey && transactionValue){ var body_req = { - e2e_id: value, + e2e_id: e2eid, pix_key: sellerPixKey, pix_value: transactionValue, }; var resp = await api.post("http://localhost:8000/validate_pix", body_req) .catch((reason: Error) => { console.log('entrou no erro', reason); - pixIsValid.value = 2; + isPixValid.value = 2; return; }); console.log("馃殌 ~ file: QrCodeForm.vue:47 ~ validatePix ~ resp", resp); console.log(resp.status); - pixIsValid.value = 1; + isPixValid.value = 1; } else { - pixIsValid.value = 0; + isPixValid.value = 0; } }; @@ -91,7 +87,7 @@ const validatePix = async (value: any) => { height="16" class="pt-2 mb-5 cursor-pointer" /> - + ATEN脟脙O! A transa莽茫o s贸 ser谩 processada ap贸s inserir o c贸digo de autentica莽茫o. Caso contr谩rio n茫o conseguiremos comprovar o seu dep贸sito e n茫o ser谩 poss铆vel transferir os tokens para sua @@ -105,10 +101,10 @@ const validatePix = async (value: any) => { type="text" placeholder="Digite o c贸digo do comprovante PIX" @input="debounce(handleInputEvent, 500)($event)" - class="text-md box-border w-full box-border p-2 h-6 mb-2" + class="text-md w-full box-border p-2 h-6 mb-2 outline-none" /> -
-
+
+
Invalid Icon { >
-
-
+
Valid Icon {