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