<script setup lang="ts">
import { ElMessage } from 'element-plus'
import { createCase } from '../api'
import Form from '../components/Form.vue'
import type { CaseFormData } from '../types'

const router = useRouter()
const handleSubmit = async (data: CaseFormData) => {
  await createCase(data)
  ElMessage.success('创建成功')
  router.back()
}
</script>

<template>
  <AppCard title="新增案例">
    <Form @submit="handleSubmit" />
  </AppCard>
</template>
