feat: add services

This commit is contained in:
EsioFreitas 2022-12-07 21:03:47 -03:00 committed by geovanne97
parent 979e5f9fb1
commit 3d78620064
3 changed files with 23 additions and 7933 deletions

7928
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ import { pix } from "../utils/QrCodePix";
import { ref } from "vue";
import { debounce } from "@/utils/debounce";
import CustomButton from "./CustomButton.vue";
import axios from "axios";
import api from "../services/index";
const props = defineProps({
pixTarget: String,
@ -37,13 +37,17 @@ const validatePix = async (value: any) => {
var sellerPixKey = props.pixTarget;
var transactionValue = props.tokenValue;
// var body_req = {
// e2e_id: value,
// pix_key: sellerPixKey,
// pix_value: transactionValue,
// };
var body_req = {
e2e_id: value,
pix_key: sellerPixKey,
pix_value: transactionValue,
pix_key: '12345678',
pix_value: 100,
};
var resp = await axios.post("http://localhost:8000/validate_pix", body_req);
var resp = await api.post("http://localhost:8000/validate_pix", body_req);
console.log("🚀 ~ file: QrCodeForm.vue:47 ~ validatePix ~ resp", resp);
if (value == "123456") {

14
src/services/index.ts Normal file
View File

@ -0,0 +1,14 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import axios from "axios";
const defaultConfig = {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*"
};
const api = axios.create({
...defaultConfig,
baseURL: "http://localhost:8000",
});
export default api;