import { Form, Upload, Button} from 'antd' import { UploadOutlined} from '@ant-design/icons' import { useState } from 'react' import { upload } from './factory' export default function UploadFileForm({url, onUploadStart, onUploadComplete, onUploadError}) { const [isSubmitButtonEnabled, setSubmitButtonEnabled] = useState(false) const [form] = Form.useForm(); const handleFileSend = async (values) => { if(onUploadStart) onUploadStart() try { const values = await form.validateFields(); const formData = new FormData() values.documentFile.fileList.forEach((val) => { formData.append("files", val.originFileObj); }); await upload(url, formData) } catch(error) { if(onUploadError) onUploadError(error) } finally { form.resetFields() if(onUploadComplete) onUploadComplete() } } return(