add types
This commit is contained in:
@@ -28,7 +28,7 @@ export default async function Page(props: {
|
||||
if (result.error) {
|
||||
errorMessage = `${result.error}`;
|
||||
} else {
|
||||
student = result;
|
||||
student = result as Student;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
'use client';
|
||||
|
||||
interface InformationProps {
|
||||
[key: string]: string | number | undefined;
|
||||
}
|
||||
|
||||
export default function Information(props: InformationProps) {
|
||||
// Obtenemos las entradas (key + value) y filtramos los que sean undefined
|
||||
const entries = Object.entries(props).filter(([_, value]) => value !== undefined);
|
||||
|
||||
if (entries.length === 0) return null; // no mostrar nada si no hay datos
|
||||
if (entries.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className="information">
|
||||
@@ -21,5 +18,5 @@ export default function Information(props: InformationProps) {
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
//IO
|
||||
@@ -56,3 +56,4 @@ function SearchUser(props: urlProp) {
|
||||
}
|
||||
|
||||
export default SearchUser;
|
||||
//IO
|
||||
@@ -0,0 +1,10 @@
|
||||
interface Carrera {
|
||||
carrera: string;
|
||||
}
|
||||
|
||||
interface Student {
|
||||
id_cuenta: number;
|
||||
nombre: string;
|
||||
carrera: Carrera;
|
||||
credito: number;
|
||||
}
|
||||
Reference in New Issue
Block a user