Adjusted request for create participants.
This commit is contained in:
parent
1ec4780e14
commit
8eb10f493f
@ -102,3 +102,10 @@ cd P2Pix-Front-End
|
|||||||
# Run docker-compose up command
|
# Run docker-compose up command
|
||||||
docker-compose up
|
docker-compose up
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Backend Communication
|
||||||
|
|
||||||
|
Backend Repo: `https://gitea.kosmos.org/hueso/helpix`
|
||||||
|
|
||||||
|
Backend Endpoint: `https://api.p2pix.co/release/1279331`
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ const formRef = ref<HTMLFormElement | null>(null);
|
|||||||
const user = useUser();
|
const user = useUser();
|
||||||
const { walletAddress, selectedToken } = user;
|
const { walletAddress, selectedToken } = user;
|
||||||
|
|
||||||
const fullName = ref<string>("");
|
|
||||||
const offer = ref<string>("");
|
const offer = ref<string>("");
|
||||||
const identification = ref<string>("");
|
const identification = ref<string>("");
|
||||||
const account = ref<string>("");
|
const account = ref<string>("");
|
||||||
@ -72,7 +71,7 @@ const handleSubmit = (e: Event): void => {
|
|||||||
|
|
||||||
const data: Participant = {
|
const data: Participant = {
|
||||||
offer: offer.value,
|
offer: offer.value,
|
||||||
fullName: fullName.value,
|
chainID: user.networkId.value,
|
||||||
identification: processedIdentification,
|
identification: processedIdentification,
|
||||||
bankIspb: selectedBank.value?.ISPB,
|
bankIspb: selectedBank.value?.ISPB,
|
||||||
accountType: accountType.value,
|
accountType: accountType.value,
|
||||||
@ -185,21 +184,6 @@ const handleSelectedToken = (token: TokenEnum): void => {
|
|||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</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 -->
|
<!-- CPF or CNPJ input -->
|
||||||
<div
|
<div
|
||||||
class="flex flex-col w-full bg-white sm:px-10 px-6 py-4 rounded-lg border-y-10"
|
class="flex flex-col w-full bg-white sm:px-10 px-6 py-4 rounded-lg border-y-10"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export interface Participant {
|
export interface Participant {
|
||||||
offer: string;
|
offer: string;
|
||||||
fullName: string;
|
chainID: number;
|
||||||
identification: string;
|
identification: string;
|
||||||
bankIspb?: string;
|
bankIspb?: string;
|
||||||
accountType: string;
|
accountType: string;
|
||||||
@ -23,25 +23,38 @@ export interface Offer {
|
|||||||
// https://apoio.developers.bb.com.br/sandbox/spec/665797498bb48200130fc32c
|
// https://apoio.developers.bb.com.br/sandbox/spec/665797498bb48200130fc32c
|
||||||
|
|
||||||
export const createParticipant = async (participant: Participant) => {
|
export const createParticipant = async (participant: Participant) => {
|
||||||
const response = await fetch(`${process.env.VUE_APP_API_URL}/participants`, {
|
console.log("Creating participant", participant);
|
||||||
|
const response = await fetch(
|
||||||
|
`${import.meta.env.VITE_APP_API_URL}/participants`,
|
||||||
|
{
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
body: JSON.stringify(participant),
|
body: JSON.stringify(participant),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
return { ...participant, id: data.id } as ParticipantWithID;
|
return { ...participant, id: data.id } as ParticipantWithID;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createSolicitation = async (offer: Offer) => {
|
export const createSolicitation = async (offer: Offer) => {
|
||||||
const response = await fetch(`${process.env.VUE_APP_API_URL}/solicitation`, {
|
const response = await fetch(
|
||||||
|
`${import.meta.env.VITE_APP_API_URL}/solicitation`,
|
||||||
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
body: JSON.stringify(offer),
|
body: JSON.stringify(offer),
|
||||||
});
|
}
|
||||||
|
);
|
||||||
return response.json();
|
return response.json();
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSolicitation = async (id: string) => {
|
export const getSolicitation = async (id: string) => {
|
||||||
const response = await fetch(
|
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();
|
const obj: any = response.json();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user