mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-23 16:30:41 +01:00
21 lines
407 B
Vue
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>
|