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:
Arthur 2022-05-20 11:04:37 +02:00 committed by GitHub
parent 36ad29a67c
commit 2a43cb4130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -13,6 +13,7 @@ function useFetch(
type UseFetchOptions = {
method?: string,
params?: SearchParams,
body?: RequestInit['body'] | Record<string, any>
headers?: {key: string, value: string}[],
baseURL?: string,
server?: boolean
@ -33,9 +34,10 @@ type DataT = {
## Params
* **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
* `params`: Query params
* `body`: Request body - automatically stringified (if an object is passed).
* `headers`: Request headers
* `baseURL`: Base URL for the request
* **Options (from `useAsyncData`)**: