File size: 560 Bytes
47203d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { apiFetch } from './client'
import type { StudentTopic, StudentSession } from '../types'

export async function getStudentTopics(): Promise<StudentTopic[]> {
  const res = await apiFetch('/api/student/topics')
  if (!res.ok) {
    const err = await res.json()
    throw new Error(err.detail ?? 'Failed to load topics')
  }
  return res.json()
}

export async function getStudentSessions(): Promise<StudentSession[]> {
  const res = await apiFetch('/api/student/sessions')
  if (!res.ok) throw new Error('Failed to load sessions')
  return res.json()
}