Files
trpc-nuxt/playground/app.vue
2022-05-18 21:40:33 -07:00

21 lines
407 B
Vue

<script setup lang="ts">
const client = useClient()
const key = 'getUser'
const { data, pending, error } = await useTRPCAsyncData(key, () => client.query(key, {
username: 'jcena',
}))
</script>
<template>
<div>
<div v-if="data">
{{ JSON.stringify(data, null, 2) }}
</div>
<div v-else-if="error">
asdx {{ JSON.stringify(error.data, null, 2) }}
</div>
</div>
</template>