added new style and fixed send token

This commit is contained in:
2025-12-08 18:02:33 -06:00
parent 106784c4dd
commit f710f4df96
8 changed files with 133 additions and 76 deletions
+17 -3
View File
@@ -1,11 +1,25 @@
import axios from "axios";
import { envConfig } from "./config";
import apiClient from "./apiClient";
import { redirect } from "next/navigation";
import { cookies } from "next/headers";
if (!envConfig.apiUrl) {
throw new Error("API URL is not defined in envConfig");
}
export async function GetStudent(numAcount: number) {
const cookieStore = cookies();
const token = (await cookieStore).get("token")?.value;
if (!token) redirect("/");
try {
const response = await apiClient.get(
`/student/${numAcount}`
const response = await axios.get(
`${envConfig.apiUrl}/student/${numAcount}`,
{
headers: {
Authorization: `Bearer ${token}`,
},
}
);
return response.data;