Adjusted request for create participants.

This commit is contained in:
Filipe Soccol 2025-05-21 10:43:00 -03:00
parent 1ec4780e14
commit 8eb10f493f
3 changed files with 31 additions and 27 deletions

View File

@ -102,3 +102,10 @@ cd P2Pix-Front-End
# Run docker-compose up command
docker-compose up
```
### Backend Communication
Backend Repo: `https://gitea.kosmos.org/hueso/helpix`
Backend Endpoint: `https://api.p2pix.co/release/1279331`

View File

@ -26,7 +26,6 @@ const formRef = ref<HTMLFormElement | null>(null);
const user = useUser();
const { walletAddress, selectedToken } = user;
const fullName = ref<string>("");
const offer = ref<string>("");
const identification = ref<string>("");
const account = ref<string>("");
@ -72,7 +71,7 @@ const handleSubmit = (e: Event): void => {
const data: Participant = {
offer: offer.value,
fullName: fullName.value,
chainID: user.networkId.value,
identification: processedIdentification,
bankIspb: selectedBank.value?.ISPB,
accountType: accountType.value,
@ -185,21 +184,6 @@ const handleSelectedToken = (token: TokenEnum): void => {
</transition>
</div>
</div>
<!-- Full name input -->
<div
class="flex flex-col w-full bg-white sm:px-10 px-6 py-4 rounded-lg border-y-10"
>
<input
type="text"
v-model="fullName"
class="border-none outline-none sm:text-lg text-sm text-gray-900 w-full"
maxlength="60"
:class="{ 'text-xl font-medium': fullName }"
placeholder="Digite seu nome completo"
required
/>
</div>
<!-- CPF or CNPJ input -->
<div
class="flex flex-col w-full bg-white sm:px-10 px-6 py-4 rounded-lg border-y-10"

View File

@ -1,6 +1,6 @@
export interface Participant {
offer: string;
fullName: string;
chainID: number;
identification: string;
bankIspb?: string;
accountType: string;
@ -23,25 +23,38 @@ export interface Offer {
// https://apoio.developers.bb.com.br/sandbox/spec/665797498bb48200130fc32c
export const createParticipant = async (participant: Participant) => {
const response = await fetch(`${process.env.VUE_APP_API_URL}/participants`, {
method: "PUT",
body: JSON.stringify(participant),
});
console.log("Creating participant", participant);
const response = await fetch(
`${import.meta.env.VITE_APP_API_URL}/participants`,
{
method: "PUT",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(participant),
}
);
const data = await response.json();
return { ...participant, id: data.id } as ParticipantWithID;
};
export const createSolicitation = async (offer: Offer) => {
const response = await fetch(`${process.env.VUE_APP_API_URL}/solicitation`, {
method: "POST",
body: JSON.stringify(offer),
});
const response = await fetch(
`${import.meta.env.VITE_APP_API_URL}/solicitation`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(offer),
}
);
return response.json();
};
export const getSolicitation = async (id: string) => {
const response = await fetch(
`${process.env.VUE_APP_API_URL}/solicitation/${id}`
`${import.meta.env.VITE_APP_API_URL}/solicitation/${id}`
);
const obj: any = response.json();