mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
docs(api): improve useFetch
docs for body type and additional ohmyfetch options (#4985)
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com> Co-authored-by: pooya parsa <pyapar@gmail.com>
This commit is contained in:
parent
36ad29a67c
commit
2a43cb4130
@ -13,6 +13,7 @@ function useFetch(
|
|||||||
type UseFetchOptions = {
|
type UseFetchOptions = {
|
||||||
method?: string,
|
method?: string,
|
||||||
params?: SearchParams,
|
params?: SearchParams,
|
||||||
|
body?: RequestInit['body'] | Record<string, any>
|
||||||
headers?: {key: string, value: string}[],
|
headers?: {key: string, value: string}[],
|
||||||
baseURL?: string,
|
baseURL?: string,
|
||||||
server?: boolean
|
server?: boolean
|
||||||
@ -33,9 +34,10 @@ type DataT = {
|
|||||||
## Params
|
## Params
|
||||||
|
|
||||||
* **Url**: The URL to fetch
|
* **Url**: The URL to fetch
|
||||||
* **Options (from [ohmyfetch](https://github.com/unjs/ohmyfetch))**:
|
* **Options (extends [unjs/ohmyfetch](https://github.com/unjs/ohmyfetch) options & [AsyncDataOptions](/api/composables/use-async-data#params))**:
|
||||||
* `method`: Request method
|
* `method`: Request method
|
||||||
* `params`: Query params
|
* `params`: Query params
|
||||||
|
* `body`: Request body - automatically stringified (if an object is passed).
|
||||||
* `headers`: Request headers
|
* `headers`: Request headers
|
||||||
* `baseURL`: Base URL for the request
|
* `baseURL`: Base URL for the request
|
||||||
* **Options (from `useAsyncData`)**:
|
* **Options (from `useAsyncData`)**:
|
||||||
|
Loading…
Reference in New Issue
Block a user