Files
simrsx-fe/app/components/content/treatment-report/add.vue
T
Khafid Prayoga f5704536d1 feat(treatment-report): add error handling and toast notification
Implement error handling in treatment report form submission and display toast notifications when errors occur. The form now emits error events and prevents default form submission behavior.
2025-11-25 21:12:18 +07:00

41 lines
894 B
Vue

<script setup lang="ts">
// type
import { genDoctor, type Doctor } from '~/models/doctor'
import type { TreatmentReportFormData } from '~/schemas/treatment-report.schema'
// components
import { toast } from '~/components/pub/ui/toast'
import AppTreatmentReportEntry from '~/components/app/treatment-report/entry-form.vue'
const doctors = ref<Doctor[]>([])
// TODO: dummy data
;(() => {
doctors.value = [genDoctor()]
})()
</script>
<template>
<AppTreatmentReportEntry
:isLoading="false"
@submit="(val) => console.log(val)"
@error="
(err: Error) => {
toast({
title: 'Terjadi Kesalahan',
description: err.message,
variant: 'destructive',
})
}
"
:doctors="doctors"
:initialValues="
{
operatorTeam: {
// dpjpId: -1,
},
} as TreatmentReportFormData
"
/>
</template>