Skip to content

Commit

Permalink
Refactor fetching and signing commitments, and updating payment infor…
Browse files Browse the repository at this point in the history
…mation
  • Loading branch information
yoelmarain committed Sep 25, 2024
1 parent fd6b9fc commit 3260d8d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions FrontAdmin/src/API-Alumnos/Compromiso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const FetchCompromisos = async () => {
try {

Check warning on line 5 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Insert `·`
const token = Cookies.get('tokennn');
// const dni = Cookies.get('dni)
const dni = 42790229;
const dni = 36562786;
const response = await fetch(`http://localhost:8000/api/firmas/firmas-de-alumno/${dni}/`, {

Check warning on line 9 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Replace ``http://localhost:8000/api/firmas/firmas-de-alumno/${dni}/`,·{⏎····` with `⏎······`http://localhost:8000/api/firmas/firmas-de-alumno/${dni}/`,⏎······{⏎`
method: 'GET',
headers: {

Check warning on line 11 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Delete `····`
Expand Down Expand Up @@ -49,7 +49,7 @@ export const FirmarCompromiso = async () => {
try {
const token = Cookies.get('tokennn');
// const dni = Cookies.get('dni')
const dni = 42790229;
const dni = 36562786;
const response = await fetch(`http://localhost:8000/api/firmas/firmar-compromiso/${dni}/`, {
method: 'POST',
headers: {
Expand Down
11 changes: 5 additions & 6 deletions FrontAdmin/src/API-Alumnos/Pagos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const FetchPostPago = async (
try {
const token = Cookies.get('tokennn');
//const dni = Cookies.get('dni');
const dni = 42790229; // Puedes obtener esto desde las cookies también
const dni = 36562786; // Puedes obtener esto desde las cookies también

// Crea un nuevo objeto FormData
const formData = new FormData();
Expand All @@ -29,17 +29,16 @@ export const FetchPostPago = async (
console.log('Nro transferencia:', nro_transferencia);

// Realiza la solicitud fetch
const response = await fetch(`http://localhost:8000/api/pagos/alumno/${dni}`, {
const response = await fetch(`http://localhost:8000/api/pagos/alumno/${dni}/`, {
method: 'POST',
headers: {
Authorization: `Bearer ${token}`, // Mantén el token
// No establezcas 'Content-Type', FormData lo manejará automáticamente
Authorization: `Bearer ${token}`,
},
body: formData,
});

if (response.ok) {
return await response.json(); // Retorna la respuesta en formato JSON
return await response.json();
} else {
const errorData = await response.json();
throw new Error(`Error en la respuesta del servidor: ${errorData.message}`);
Expand All @@ -54,7 +53,7 @@ export const FetchGetCuotas = async () => {
try {
const token = Cookies.get('tokennn');
//const dni = Cookies.get('dni');
const dni = 42790229;
const dni = 36562786;

const response = await fetch(`http://localhost:8000/api/cuotas/alumno/${dni}/?limit=6&offset=0/`, {
method: 'GET',
Expand Down
2 changes: 1 addition & 1 deletion FrontAdmin/src/API/Login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const FetchLogin = async (password: string, account: string) => {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ password, account }),
body: JSON.stringify({ email: account ,password }),
});

if (response.ok) {
Expand Down

0 comments on commit 3260d8d

Please sign in to comment.