Spaces:
Sleeping
Sleeping
| import { apiFetch } from './client' | |
| import type { InstructorStudent, StudentAttempt } from '../types' | |
| export interface StudentDetail { | |
| id: string | |
| full_name: string | |
| email: string | |
| sessions: StudentAttempt[] | |
| } | |
| export async function getInstructorStudents(): Promise<InstructorStudent[]> { | |
| const res = await apiFetch('/api/instructor/students') | |
| if (!res.ok) { | |
| const err = await res.json() | |
| throw new Error(err.detail ?? 'Failed to load students') | |
| } | |
| return res.json() | |
| } | |
| export async function getStudentDetail(studentId: string): Promise<StudentDetail> { | |
| const res = await apiFetch(`/api/instructor/students/${studentId}`) | |
| if (!res.ok) throw new Error('Failed to load student') | |
| return res.json() | |
| } | |