forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB0069847Burak Boduroğlu2 months ago552 commits

getUserSearch.ts16 lines, 575 bytesHistoryRawDownload
1import { client } from "../client";
2import { appendPageParams, normalizePage, type Page, type PageParams } from "../client";
3import type { PersonRef, Role } from "../client";
4
5export async function getUserSearch(
6 query: string,
7 signal?: AbortSignal,
8 role?: Role,
9 page?: PageParams,
10): Promise<Page<PersonRef>> {
11 const params = new URLSearchParams({ q: query });
12 if (role) params.set("role", role);
13 appendPageParams(params, page);
14 const data = await client<unknown>(`/users/search?${params.toString()}`, { signal });
15 return normalizePage<PersonRef>(data);
16}