This commit is contained in:
Connor van Spronssen 2025-02-18 11:13:55 +01:00 committed by GitHub
commit ff122b80df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,18 +27,27 @@ interface NitroFetchOptions<R extends NitroFetchRequest, M extends AvailableRout
type ComputedFetchOptions<R extends NitroFetchRequest, M extends AvailableRouterMethod<R>> = ComputedOptions<NitroFetchOptions<R, M>>
export interface UseFetchOptions<
/**
* Options for the useFetch composable.
* For GET and HEAD requests, the body property is automatically
* omitted to align with HTTP/1.1 specifications (RFC 7231).
*/
export type UseFetchOptions<
ResT,
DataT = ResT,
PickKeys extends KeysOf<DataT> = KeysOf<DataT>,
DefaultT = undefined,
R extends NitroFetchRequest = string & {},
M extends AvailableRouterMethod<R> = AvailableRouterMethod<R>,
> extends Omit<AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>, 'watch'>, ComputedFetchOptions<R, M> {
key?: string
$fetch?: typeof globalThis.$fetch
watch?: MultiWatchSources | false
}
> = Omit<AsyncDataOptions<ResT, DataT, PickKeys, DefaultT>, 'watch'> &
(M extends 'GET' | 'get' | 'HEAD' | 'head'
? Omit<ComputedFetchOptions<R, M>, 'body'>
: ComputedFetchOptions<R, M>
) & {
key?: string
$fetch?: typeof globalThis.$fetch
watch?: MultiWatchSources | false
}
/**
* Fetch data from an API endpoint with an SSR-friendly composable.