mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 01:45:53 +00:00
feat(nuxt): allow passing custom fetch options to useFetch
(#5660)
This commit is contained in:
parent
b5f5f7d5ba
commit
93d60a30de
@ -38,16 +38,32 @@ export function useFetch<
|
||||
return (isRef(r) ? r.value : r) as NitroFetchRequest
|
||||
})
|
||||
|
||||
const {
|
||||
server,
|
||||
lazy,
|
||||
default: defaultFn,
|
||||
transform,
|
||||
pick,
|
||||
watch,
|
||||
initialCache,
|
||||
...fetchOptions
|
||||
} = opts
|
||||
|
||||
const _fetchOptions = {
|
||||
...opts,
|
||||
...fetchOptions,
|
||||
cache: typeof opts.cache === 'boolean' ? undefined : opts.cache
|
||||
}
|
||||
|
||||
const _asyncDataOptions: AsyncDataOptions<_ResT, Transform, PickKeys> = {
|
||||
...opts,
|
||||
server,
|
||||
lazy,
|
||||
default: defaultFn,
|
||||
transform,
|
||||
pick,
|
||||
initialCache,
|
||||
watch: [
|
||||
_request,
|
||||
...(opts.watch || [])
|
||||
...(watch || [])
|
||||
]
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user