docs(data-fetching): fix and improve example (#4824)

This commit is contained in:
Salim Absi 2022-05-06 14:12:59 +03:00 committed by GitHub
parent a862a67c80
commit ecc8c0adb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -118,13 +118,13 @@ watch(posts, (newPosts) => {
Sometimes throughout the course of your user's page visit, you may need to refresh the data loaded from the API. This can happen if the user chooses to paginate, filter results, search, etc.
You can make use of the `refresh()` method returned from the `useAsyncData()` composable to refresh the data with different query parameters:
You can make use of the `refresh()` method returned from the `useFetch()` composable to refresh the data with different query parameters:
```vue
<script setup>
const page = ref(1);
const { data:users, loading, refresh, error } = await useFetch(() => `users?page=${page.value}&take=6`, { baseURL: config.API_BASE_URL }
const { data: users, pending, refresh, error } = await useFetch(() => `users?page=${page.value}&take=6`, { baseURL: config.API_BASE_URL }
);
function previous(){