hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits
| 1 | import { client } from "../client"; |
| 2 | import { appendPageParams, normalizePage, type Page, type PageParams } from "../client"; |
| 3 | import type { Homework } from "../client"; |
| 4 | |
| 5 | /** |
| 6 | * `GET /homework` takes `limit`/`offset` only — unlike events and exams it has |
| 7 | * no schedule window, so a due-date filter has to happen in the caller. |
| 8 | */ |
| 9 | export type HomeworkListParams = PageParams; |
| 10 | |
| 11 | export async function getHomework(params?: HomeworkListParams, signal?: AbortSignal): Promise<Page<Homework>> { |
| 12 | const query = new URLSearchParams(); |
| 13 | appendPageParams(query, params); |
| 14 | const suffix = query.size ? `?${query}` : ""; |
| 15 | const data = await client<unknown>(`/homework${suffix}`, { signal }); |
| 16 | return normalizePage<Homework>(data); |
| 17 | } |