forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

getBoards.ts17 lines, 689 bytesHistoryRawDownload
1import { appendPageParams, client, normalizePage, type Page, type PageParams } from "../client";
2import 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.
6export 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}