docs: fix api examples (#4870)

This commit is contained in:
Salim Absi 2022-05-09 17:12:41 +03:00 committed by GitHub
parent b633a9c106
commit c0f0670ad7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -182,7 +182,7 @@ The example below adds the request headers to an isomorphic `fetch` call to ensu
```vue ```vue
<script setup> <script setup>
const { data } = useFetch('/api/me', { const { data } = await useFetch('/api/me', {
headers: useRequestHeaders(['cookie']) headers: useRequestHeaders(['cookie'])
}) })
</script> </script>

View File

@ -57,7 +57,7 @@ By default, Nuxt waits until a `refresh` is finished before it can be executed a
## Example ## Example
```ts ```ts
const { data, pending, error, refresh } = useFetch( const { data, pending, error, refresh } = await useFetch(
'https://api.nuxtjs.dev/mountains', 'https://api.nuxtjs.dev/mountains',
{ {
pick: ['title'] pick: ['title']

View File

@ -6,7 +6,7 @@ Within the template of a Vue component, you can access the route using `$route`.
## Example ## Example
In the following example, we call an API via `useAsyncData` using a dynamic page parameter - `slug` - as part of the URL. In the following example, we call an API via `useFetch` using a dynamic page parameter - `slug` - as part of the URL.
```html [~/pages/[slug].vue] ```html [~/pages/[slug].vue]
<script setup> <script setup>