update readme

This commit is contained in:
Robert Soriano
2022-05-17 15:16:12 -07:00
parent f0000a8a91
commit c2001cdbac
2 changed files with 13 additions and 5 deletions

View File

@@ -52,4 +52,10 @@ export const responseMeta = () => {
}
```
Use the client like so:
```html
<script setup lang="ts">
const { data } = await useTrpcQuery('hello')
</script>
```

View File

@@ -1,14 +1,16 @@
<script setup lang="ts">
const { data, error } = await useTrpcQuery('getUser', {
name: 'johns',
})
const { data, pending } = useLazyTrpcQuery('hello', undefined)
watchEffect(() => {
console.log(data.value)
console.log('err', error.value)
})
</script>
<template>
<div>{{ data.name }}</div>
<div v-if="pending">
Loading...
</div>
<div v-else>
{{ data }}
</div>
</template>