Files
front-AT/app/lib/getStudent.ts
T

20 lines
439 B
TypeScript
Raw Normal View History

2025-09-17 16:47:19 -06:00
import axios from "axios";
import { envConfig } from "./config";
2025-09-22 12:15:32 -04:00
export async function GetStudent(numAcount: number) {
2025-09-17 16:47:19 -06:00
try {
2025-09-22 14:53:19 -06:00
const response = await axios.get(
`${envConfig.apiUrl}/student/${numAcount}`
);
2025-09-24 15:49:59 -06:00
2025-09-17 16:47:19 -06:00
return response.data;
} catch (error: any) {
const msg =
error.response?.data?.message ||
error.message ||
"Error desconocido al obtener estudiante";
return { error: msg };
}
}
2025-09-22 14:53:19 -06:00
//IO