Vue Query client
This package provides a type-safe integration of Vue Query with WunderGraph. Vue Query is a data fetching library for Vue. With just one hook, you can significantly simplify the data fetching logic in your project. And it also covered in all aspects of speed, correctness, and stability to help you build better experiences.
Installation
Configuration
Before you can use the hooks, you need to modify your code generation to include the base typescript client.
Now you can configure the hooks. Create a new file, for example lib/wundergraph.ts
and add the following code:
In your main.ts
register your the vue-query plugin:
Usage
Now you can use the hooks in your components:
useQuery
useQuery (Live query)
useSubscription
useMutation
useFileUpload
useAuth
useUser
queryKey
You can use the queryKey
helper function to create a unique key for the query in a typesafe way. This is useful if you want to invalidate the query after mutating.
Options
You can use all available options from Vue Query with the hooks.