Skip to content

Commit

Permalink
HotFix
Browse files Browse the repository at this point in the history
  • Loading branch information
samuop committed Sep 25, 2024
1 parent 6eeecd3 commit fd97683
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
9 changes: 6 additions & 3 deletions FrontAdmin/src/API/Montos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ export const loadPDF = async (id :string,file: File) => {
const data = await response.json();
return data;
} else {
throw new Error('Error en la respuesta del servidor');
const errorResponse = await response.json();
throw new Error(
'Error en la respuesta del servidor: ' + JSON.stringify(errorResponse)
);
}
} catch (error) {
throw new Error('Network error: ' + error);
throw new Error('Network error: ' + JSON.stringify(error));
}
}
};
6 changes: 3 additions & 3 deletions FrontAdmin/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function App() {
const { isAuthenticated, rolUser } = useAuth();
console.log(isAuthenticated, rolUser);
const isAdmin = rolUser.includes('staff') || rolUser.includes('superuser');
// const isAlumno = rolUser.includes('alumno');
const isAlumno = rolUser.includes('alumno');


return (
Expand All @@ -26,7 +26,7 @@ function App() {
{isAuthenticated && isAdmin && (
<Route path="/admin/*" element={<Admin />} />
)}
{isAuthenticated && !isAdmin && (
{isAuthenticated && isAlumno && (
<Route path="/alumnos/*" element={<Alumnos />} />
)}
<Route
Expand All @@ -38,7 +38,7 @@ function App() {
isAuthenticated
? isAdmin
? '/admin/alumnos'
: '/alumnos/cuenta'
: isAlumno? '/alumnos/cuenta' : '/auth'
: '/auth'
}
/>
Expand Down
2 changes: 1 addition & 1 deletion FrontAdmin/src/Context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const AuthContext = createContext<AuthContextType | undefined>(undefined);

const AuthProvider = ({ children }: { children: ReactNode }) => {
const [isAuthenticated, setIsAuthenticated] = useState(
!Cookies.get('access_token') ? false : true
!Cookies.get('tokennn') ? false : true
);
const [rolUser, setRolUser] = useState<String[]>([]);

Check failure on line 19 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
let refreshTimeout: NodeJS.Timeout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ interface Compromiso {
cuota_reducida: number;
cuota_reducida_2venc: number;
cuota_reducida_3venc: number;
fecha_vencimiento_1: number;
fecha_vencimiento_2: number;
fecha_vencimiento_3: number;
}

interface CardCargaProps {
Expand Down Expand Up @@ -103,6 +106,9 @@ const Montos = ({ compromisos, fetchMontos }: CardCargaProps) => {
cuota_reducida: 0,
cuota_reducida_2venc: 0,
cuota_reducida_3venc: 0,
fecha_vencimiento_1: 0,
fecha_vencimiento_2: 0,
fecha_vencimiento_3: 0,
});

const toast = useToast();
Expand Down Expand Up @@ -138,6 +144,7 @@ const Montos = ({ compromisos, fetchMontos }: CardCargaProps) => {
return;
}
try {
console.log('paso por aca');
await createCompromiso(tempMonto, selectedFile);

onClose();
Expand Down

0 comments on commit fd97683

Please sign in to comment.