-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
468 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import Cookies from 'js-cookie' | ||
// los dni son la mama de lo hardcodeado | ||
|
||
export const FetchCompromisos = async () => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
// const dni = Cookies.get('dni) | ||
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 GitHub Actions / Linter de Código
|
||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; | ||
} else { | ||
throw new Error('Error en la respuesta del servidor'); | ||
} | ||
} catch (error) { | ||
throw new Error('Network error: ' + error); | ||
} | ||
}; | ||
|
||
export const FetchUltimoCompromiso = async () => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
const response = await fetch(`http://localhost:8000/api/ultimo-compromiso-de-pago/`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; | ||
} else { | ||
throw new Error('Error en la respuesta del servidor'); | ||
} | ||
} catch (error) { | ||
throw new Error('Network error: ' + error); | ||
} | ||
}; | ||
|
||
export const FirmarCompromiso = async () => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
// const dni = Cookies.get('dni') | ||
const dni = 36562786; | ||
const response = await fetch(`http://localhost:8000/api/firmas/firmar-compromiso/${dni}/`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
if (response.ok) { | ||
return; | ||
} else { | ||
throw new Error('Error en la respuesta del servidor'); | ||
} | ||
} catch (error) { | ||
throw new Error('Network error: ' + error); | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.