Function: prepareFetchHookData()
prepareFetchHookData<
T,P,R>(fetchStrategy,ctx,options):object
Defined in: packages/next/src/data/server/fetchHookData.ts:71
Prepares all the things for fetchHookData
Type Parameters
T
T = unknown
P
P extends EndpointParams = EndpointParams
R
R = T
Parameters
fetchStrategy
AbstractFetchStrategy<T, P, R>
The fetch strategy to use. Typically this is exposed by the hook e.g: usePosts.fetcher()
ctx
The Next.js context, either the one from getServerSideProps or getStaticProps
GetServerSidePropsContext<any, PreviewData> | GetStaticPropsContext<any, PreviewData>
options
FetchHookDataOptions<P, T> = {}
Returns
object
The various things fetchHookData needs
cache
cache:
object
cache.afterGet
cache.afterGet:
undefined| <E,P,R>(options,data) =>Promise<FetchResponse<R>> =cacheConfig.afterGet
cache.beforeSet
cache.beforeSet:
undefined| <E,P,R>(options,data) =>Promise<FetchResponse<R>> =cacheConfig.beforeSet
cache.cacheHandler
cache.cacheHandler:
undefined|FetchStrategyCacheHandler=cacheConfig.cacheHandler
cache.enabled
cache.enabled:
boolean=shouldCache
cache.ttl
cache.ttl:
number=cacheTTL
cacheKey
cacheKey:
object
cacheKey.args
cacheKey.args:
Partial<P> &object
Type declaration
sourceUrl
sourceUrl:
string
cacheKey.url
cacheKey.url:
string
hostOrSlug
hostOrSlug:
undefined|string
params
params:
Partial<P> =finalParams
path
path:
string=stringPath
urlParams
urlParams:
Partial<P>