hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { |
| 2 | appendPageParams, |
| 3 | client, |
| 4 | normalizePage, |
| 5 | type Page, |
| 6 | } from "../client"; |
| 7 | import type { BoardHistoryParams, StrokeRow } from "./types"; |
| 8 | |
| 9 | // The whole append-only log, oldest first, clear markers included. `epoch` |
| 10 | // narrows to a single epoch (for session replay); omit for the whole life. |
| 11 | export async function getBoardHistory( |
| 12 | id: string, |
| 13 | params?: BoardHistoryParams, |
| 14 | signal?: AbortSignal, |
| 15 | ): Promise<Page<StrokeRow>> { |
| 16 | const query = new URLSearchParams(); |
| 17 | if (params?.epoch != null) query.set("epoch", String(params.epoch)); |
| 18 | appendPageParams(query, params); |
| 19 | const suffix = query.toString() ? `?${query.toString()}` : ""; |
| 20 | const data = await client<unknown>(`/boards/${encodeURIComponent(id)}/history${suffix}`, { |
| 21 | signal, |
| 22 | }); |
| 23 | return normalizePage<StrokeRow>(data); |
| 24 | } |