Skip to content

Commit

Permalink
docs: remove old syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Dec 23, 2024
1 parent 1b2c828 commit b4d13b3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions docs/guide/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ export function useFilteredTodos() {
const search = ref('')
const query = useQuery({
key: () => ['todos', search.value],
query: () =>
fetch(`/api/todos?search=${search.value}`).then((res) => res.json()),
query: () => fetch(`/api/todos?search=${search.value}`).then((res) => res.json()),
})
return { search, ...query }
}
Expand Down Expand Up @@ -371,10 +370,13 @@ defineQuery(() => {
if (import.meta.env.SSR) {
search.value = fetchSomeInitialValue()
}
const query = useQuery({
key: ['todos', search.value],
query: () => fetch(`/api/todos?search=${search.value}`).then((res) => res.json()),
})
return {
search,
query: () =>
fetch(`/api/todos?search=${search.value}`).then((res) => res.json()),
...query,
}
})
```
Expand Down Expand Up @@ -403,10 +405,13 @@ defineQuery(() => {
if (import.meta.env.SSR) {
search.value = getInitialValue()
}
const query = useQuery({
key: ['todos', search.value],
query: () => fetch(`/api/todos?search=${search.value}`).then((res) => res.json()),
})
return {
search,
query: () =>
fetch(`/api/todos?search=${search.value}`).then((res) => res.json()),
...query,
}
})
```
Expand Down

0 comments on commit b4d13b3

Please sign in to comment.