Skip to content

Commit

Permalink
Dev (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
facundomelgarejo authored Sep 27, 2024
2 parents 3ffa88a + 7a76db1 commit 384dbc7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 67 deletions.
8 changes: 4 additions & 4 deletions FrontAdmin/src/API-Alumnos/Compromiso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Cookies from 'js-cookie'
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 = 36562786;
const dni = Cookies.get('dni');
// const dni = 42790229;
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 @@ -48,8 +48,8 @@ export const FetchUltimoCompromiso = async () => {
export const FirmarCompromiso = async () => {
try {
const token = Cookies.get('tokennn');
// const dni = Cookies.get('dni')
const dni = 36562786;
const dni = Cookies.get('dni')
// const dni = 42790229;
const response = await fetch(`http://localhost:8000/api/firmas/firmar-compromiso/${dni}/`, {
method: 'POST',
headers: {
Expand Down
62 changes: 4 additions & 58 deletions FrontAdmin/src/API-Alumnos/Pagos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const FetchPostPago = async (
) => {
try {
const token = Cookies.get('tokennn');
//const dni = Cookies.get('dni');
const dni = 36562786; // Puedes obtener esto desde las cookies también
const dni = Cookies.get('dni');
// const dni = 36562786; // Puedes obtener esto desde las cookies también

// Crea un nuevo objeto FormData
const formData = new FormData();
Expand Down Expand Up @@ -52,8 +52,8 @@ export const FetchPostPago = async (
export const FetchGetCuotas = async () => {
try {
const token = Cookies.get('tokennn');
//const dni = Cookies.get('dni');
const dni = 36562786;
const dni = Cookies.get('dni');
// const dni = 36562786;

const response = await fetch(`http://localhost:8000/api/cuotas/alumno/${dni}/?limit=6&offset=0/`, {
method: 'GET',
Expand All @@ -73,57 +73,3 @@ export const FetchGetCuotas = async () => {
throw new Error('Network error: ' + error);
}
};

const cuotas = [
{
numero: 0,
montoactual: 0,
fechaVencimiento: '2024-03-10',
valorpagado: 10000,
valorinformado: 0,
estado: "PAGADO",
},
{
numero: 1,
montoactual: 10000,
fechaVencimiento: '2024-03-10',
valorpagado: 0,
valorinformado: 5000,
estado: "INFORMADO",
},
{
numero: 2,
montoactual: 10000,
fechaVencimiento: '2024-04-10',
valorpagado: 0,
valorinformado: 0,
estado: "ADEUDADO",
},
{
numero: 3,
montoactual: 10000,
fechaVencimiento: '2024-05-10',
valorpagado: 0,
valorinformado: 0,
estado: "ADEUDADO",
},
{
numero: 4,
montoactual: 10000,
fechaVencimiento: '2024-06-10',
valorpagado: 0,
valorinformado: 0,
estado: "ADEUDADO",
},
{
numero: 5,
montoactual: 10000,
fechaVencimiento: '2024-07-10',
valorpagado: 0,
valorinformado: 0,
estado: "ADEUDADO",
}
];

export default cuotas;

4 changes: 2 additions & 2 deletions FrontAdmin/src/API/Montos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const FetchMontos = async (offset: number, limit: number) => {
const token = Cookies.get('tokennn');

const response = await fetch(
`${URL}/pagos/compromisos/?offset=${offset}&limit=${limit}`,
`${URL}/compromisos/`,
{
method: 'GET',
headers: {
Expand Down Expand Up @@ -63,7 +63,7 @@ export const loadPDF = async (id :string,file: File) => {
const formData = new FormData();
formData.append('archivo_pdf', file);

const response = await fetch(`${URL}/pagos/compromisos/${id}/`, {
const response = await fetch(`${URL}/compromisos/${id}/`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${token}`,
Expand Down
5 changes: 3 additions & 2 deletions FrontAdmin/src/Context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ interface AuthContextType {
const AuthContext = createContext<AuthContextType | undefined>(undefined);

const AuthProvider = ({ children }: { children: ReactNode }) => {
const [rolUser, setRolUser] = useState<String[]>([]);

Check failure on line 16 in FrontAdmin/src/Context.tsx

View workflow job for this annotation

GitHub Actions / Linter de Código

Don't use `String` as a type. Use string instead
const [isAuthenticated, setIsAuthenticated] = useState(
!Cookies.get('tokennn') ? false : true
(!Cookies.get('tokennn') ) ? false : true
);
const [rolUser, setRolUser] = useState<String[]>([]);

let refreshTimeout: NodeJS.Timeout;

const refreshToken = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const NewInterfaz = ({ compromisos }: CardCargaProps) => {

const handleViewPdf = async (url: string) => {
try {
const token = Cookies.get('access_token');
const token = Cookies.get('tokennn');
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${token}`,
Expand Down

0 comments on commit 384dbc7

Please sign in to comment.