diff --git a/next.config.js b/next.config.js index 4f00fcf..da209d1 100644 --- a/next.config.js +++ b/next.config.js @@ -28,7 +28,7 @@ const withBundleAnalyzer = nextBundleAnalyzer({ let configExport = nextConfig; -if (process.env.NODE_ENV === 'production') { +if (process.env['NODE_ENV'] === 'production') { console.log('Loaded production config'); configExport = million.next(nextConfig, { auto: true }); } diff --git a/src/api/api.ts b/src/api/api.ts index 08da243..246288d 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -39,10 +39,20 @@ export const api = { } }); - if (!res.ok) throw new Error('Failed to fetch classroom'); + if (!res.ok) throw new Error('Failed to fetch classroom members'); return res.json(); }, + getProfessor: async (id: string): Promise => { + const res = await fetch(`${API_URL}/classrooms/${encodeURIComponent(id)}/professor`, { + headers: { + ...getAuthHeaders() + } + }); + + if (!res.ok) throw new Error('Failed to fetch classroom professor'); + return res.json(); + }, create: async (data: { name: string; diff --git a/src/components/general/ClassroomCard.tsx b/src/components/general/ClassroomCard.tsx index 2133374..cb80996 100644 --- a/src/components/general/ClassroomCard.tsx +++ b/src/components/general/ClassroomCard.tsx @@ -48,7 +48,7 @@ export default function ClassroomCard({ item }: Readonly<{ item: IClassroom }>) - 24 estudiantes + {item.memberCount} estudiantes