Fix request handling

This commit is contained in:
enzoggqs 2022-12-12 15:37:03 -03:00
parent ce6aced739
commit 3985adab4e

View File

@ -25,8 +25,6 @@ pixQrCode.base64QrCode().then((code: string) => {
qrCodePayload.value = pixQrCode.payload(); qrCodePayload.value = pixQrCode.payload();
console.log(qrCodePayload);
const handleInputEvent = (event: any) => { const handleInputEvent = (event: any) => {
const { value } = event.target; const { value } = event.target;
@ -48,18 +46,15 @@ const validatePix = async (e2eid: any) => {
pix_key: sellerPixKey, pix_key: sellerPixKey,
pix_value: transactionValue, pix_value: transactionValue,
}; };
var resp = await api.post("http://localhost:8000/validate_pix", body_req)
.catch((reason: Error) => {
console.log('entrou no erro', reason);
isPixValid.value = false;
isCodeInputEmpty.value = false;
return;
});
console.log("🚀 ~ file: QrCodeForm.vue:47 ~ validatePix ~ resp", resp);
console.log(resp.status);
isCodeInputEmpty.value = false; isCodeInputEmpty.value = false;
isPixValid.value = true;
try {
await api.post("validate_pix", body_req);
isPixValid.value = true;
} catch (error) {
isPixValid.value = false;
}
} else { } else {
isCodeInputEmpty.value = false; isCodeInputEmpty.value = false;
isPixValid.value = false; isPixValid.value = false;