import React, { useEffect } from 'react' import { useForm, usePage } from '@inertiajs/react' import { toast } from 'react-toastify' export default function FormModal(props) { const { modalState } = props const { data, setData, post, processing, errors, reset, clearErrors } = useForm({ email: '', }) const handleOnChange = (event) => { setData(event.target.name, event.target.type === 'checkbox' ? event.target.checked : event.target.value); } const handleReset = () => { reset() clearErrors() modalState.setData(null) } const handleCancel = () => { handleReset() modalState.toggle() } const handleSubmit = () => { post(route('setting.add-cc'), { onSuccess: () => Promise.all([ handleReset(), modalState.toggle(), toast.success('The Data has been saved'), ]), }) } return (

CC

Tambah
Batal
) }