github logaretm/villus v2.2.0

latest releases: v3.5.1, v3.5.0, v3.4.0...
20 months ago

🆕 New features

Thanks to @jbaubree for suggesting implementing event hooks, which is a little nicer than using a watcher for detecting when a query concludes or fails.

onSuccess

This is called whenever a new result is available.

<script setup>
import { useQuery } from 'villus';

const { data } = useQuery({
  query: GetPostById,
  variables,
  onSuccess: (data) => {
    console.log(data)
  },
});
</script>

onError

It is triggered when an error occurs.

<script setup>
import { useQuery } from 'villus';

const { data } = useQuery({
  query: GetPostById,
  variables,
  onError: (err) => {
    console.log(err)
  },
});
</script>

Don't miss a new villus release

NewReleases is sending notifications on new releases.