feat: add services

This commit is contained in:
EsioFreitas 2022-12-07 21:15:37 -03:00
commit 974434519f
3 changed files with 12 additions and 7934 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 { ref } from "vue";
import { debounce } from "@/utils/debounce"; import { debounce } from "@/utils/debounce";
import CustomButton from "./CustomButton.vue"; import CustomButton from "./CustomButton.vue";
import axios from "axios"; import api from "../services/index";
const props = defineProps({ const props = defineProps({
pixTarget: String, pixTarget: String,
@ -37,13 +37,17 @@ const validatePix = async (value: any) => {
var sellerPixKey = props.pixTarget; var sellerPixKey = props.pixTarget;
var transactionValue = props.tokenValue; var transactionValue = props.tokenValue;
// var body_req = {
// e2e_id: value,
// pix_key: sellerPixKey,
// pix_value: transactionValue,
// };
var body_req = { var body_req = {
e2e_id: value, e2e_id: value,
pix_key: sellerPixKey, pix_key: "12345678",
pix_value: transactionValue, pix_value: 100,
}; };
var resp = await api.post("http://localhost:8000/validate_pix", body_req);
var resp = await axios.post("http://localhost:8000/validate_pix", body_req);
console.log("🚀 ~ file: QrCodeForm.vue:47 ~ validatePix ~ resp", resp); console.log("🚀 ~ file: QrCodeForm.vue:47 ~ validatePix ~ resp", resp);
if (value == "123456") { if (value == "123456") {

View File

@ -5,7 +5,9 @@ const defaultConfig = {
"Content-Type": "application/json", "Content-Type": "application/json",
}; };
export const api = axios.create({ const api = axios.create({
...defaultConfig, ...defaultConfig,
baseURL: "http://localhost:8000", baseURL: "http://localhost:8000",
}); });
export default api;