UNPKG

@openapi-qraft/react

Version:

OpenAPI client for React, providing type-safe requests and dynamic TanStack Query React Hooks via a modular, Proxy-based architecture.

30 lines (28 loc) 881 B
import type { ServiceOperationFetchInfiniteQuery } from '@openapi-qraft/tanstack-query-react-types'; import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js'; export const prefetchInfiniteQuery: < TSchema extends { url: string; method: 'get' | 'head' | 'options' }, TData, TParams, >( qraftOptions: CreateAPIQueryClientOptions, schema: TSchema, args: Parameters< ServiceOperationFetchInfiniteQuery< TSchema, TData, TParams, DefaultError >['prefetchInfiniteQuery'] > ) => Promise<TData> = (qraftOptions, schema, args) => { return callQueryClientMethodWithQueryKey( qraftOptions, 'prefetchInfiniteQuery', schema, true, args as never ) as never; };