Fetch the data on the client #123
-
Hello! I noticed that Pinia Colada by default executes all queries only on the server, which is very good because Vue Query requires the use of But sometimes we may want to execute a query only on the client. I suppose we could use the useQuery({
key: ['todos'],
query: () => fetch('/api/todos').then((res) => res.json())
enabled: import.meta.client // ← for client only request
}) Is it correct? In Nuxt's |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes! Using enabled is the correct way 🙌 |
Beta Was this translation helpful? Give feedback.
Yes! Using enabled is the correct way 🙌
It’s worth being documented but I don’t think it’s worth having an alias unless we find some specific case not covered by enabled