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 { PersonRef, Role } from "../client"; |
| 4 | |
| 5 | export 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 | } |