<script setup lang="ts">
/* global $fetch */
import { ref } from 'vue';

const question = ref();
const answer = ref();

async function getAnswer() {
  const message = await $fetch("/api/echo", {
    body: question.value,
    method: "POST",
  });

  answer.value = message;
}
</script>

<template>
  <VCard width="400px">
    <template #text>
      <VTextarea v-model="question" /><br>
      <p>{{ answer }}</p>
      <VBtn @click="getAnswer">
        Send
      </VBtn>
    </template>
  </VCard>
</template>
