<script setup>
import { m, q } from "#imports";
import { useQuasar } from "quasar";
const quasar = useQuasar();
const { my } = await q({
  my: {
    email: true
  }
});
const onSubmit = async (data) => {
  try {
    await m("mailTest", data);
    quasar.notify({
      message: "Email sent",
      color: "positive",
      icon: "check"
    });
  } catch (e) {
    quasar.notify({
      message: e.message,
      color: "negative",
      icon: "warning"
    });
  }
};
</script>

<template>
    <l-page title="Mail test">
        <form-kit type="l-form" @submit="onSubmit" :value="{
            email: my.email,
            subject: 'Test email',
            content: 'Hello, this is a test email'
        }">
            <form-kit type="l-input" label="Email" name="email" validation="required|email"></form-kit>
            <form-kit type="l-input" label="Subject" name="subject" validation="required"></form-kit>
            <form-kit type="l-input" input-type="textarea" label="Content" name="content" validation="required">
            </form-kit>
        </form-kit>
    </l-page>
</template>
