(
path: TApiPath,
...[
{staleTime, path: pathParams, ...options},
]: ExtractPathParams<TApiPath> extends never
? [Options & {path?: never}]
: [Options & PathParamOptions<TApiPath>]
)
| 48 | ): ApiResponse<TData> => data; |
| 49 | |
| 50 | function _apiOptions< |
| 51 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters |
| 52 | TManualData = never, |
| 53 | TApiPath extends KnownApiUrls = KnownApiUrls, |
| 54 | // todo: infer the actual data type from the ApiMapping |
| 55 | TActualData = TManualData, |
| 56 | >( |
| 57 | path: TApiPath, |
| 58 | ...[ |
| 59 | {staleTime, path: pathParams, ...options}, |
| 60 | ]: ExtractPathParams<TApiPath> extends never |
| 61 | ? [Options & {path?: never}] |
| 62 | : [Options & PathParamOptions<TApiPath>] |
| 63 | ) { |
| 64 | const url = getApiUrl(path, ...([{path: pathParams}] as OptionalPathParams<TApiPath>)); |
| 65 | const strippedOptions = stripUndefinedValues(options); |
| 66 | |
| 67 | return queryOptions({ |
| 68 | queryKey: [url, strippedOptions, {infinite: false}] as const, |
| 69 | queryFn: pathParams === skipToken ? skipToken : apiFetch<TActualData>, |
| 70 | enabled: pathParams !== skipToken, |
| 71 | staleTime, |
| 72 | select: selectJson, |
| 73 | }); |
| 74 | } |
| 75 | |
| 76 | function parsePageParam<TQueryFnData = unknown>(dir: 'previous' | 'next') { |
| 77 | // oxlint-disable-next-line react/function-component-definition -- This callback is not a React component. |
no test coverage detected