API/fetchQubeePage()
fetchQubeePage()
functionsrc/utils/fetch-qubee-page.ts2 parameters
Fetch one page of a list and parse it with the driver that built the request.
It sends the request’s headers — the page, for drivers that paginate through headers — hands the response headers to the parser, and returns a plain object: it can be cached, compared, and passed from a Server Component to a Client Component.
This is the one function of the package that performs I/O. It runs anywhere: in a Server Component, a route loader, a script, or under the fetching hooks, which all call it.
Import
Section titled “Import”import { fetchQubeePage } from '@qubeejs/react/fetch';Signature
Section titled “Signature”function fetchQubeePage<T extends object>(request: ListRequest, options: { … }): Promise<PaginatedResult<T>>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
request |
ListRequest |
What to fetch: list.request from useQubeeList, or core’s buildListRequest() |
options |
{ … } |
fetcher: what performs the request, the global fetch by default; signal: aborts it |
Returns
Section titled “Returns”The rows and the page metadata, as core’s toPlain() returns them
Example
Section titled “Example”const request = buildListRequest(articleList, readListState(articleList, await searchParams));const page = await fetchQubeePage<Article>(request);