hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { appendPageParams, client, normalizePage, type Page, type PageParams } from "../client"; |
| 2 | import type { Board } from "./types"; |
| 3 | |
| 4 | // Boards the caller created or was invited to, newest first. `q` filters by |
| 5 | // title server-side; blank after trim means no filter. |
| 6 | export async function getBoards( |
| 7 | params?: PageParams & { q?: string }, |
| 8 | signal?: AbortSignal, |
| 9 | ): Promise<Page<Board>> { |
| 10 | const query = new URLSearchParams(); |
| 11 | const q = params?.q?.trim(); |
| 12 | if (q) query.set("q", q); |
| 13 | appendPageParams(query, params); |
| 14 | const search = query.toString(); |
| 15 | const data = await client<unknown>(`/boards${search ? `?${search}` : ""}`, { signal }); |
| 16 | return normalizePage<Board>(data); |
| 17 | } |