//submit file to database
const handleSubmit = (e) => {
e.preventDefault()
//use formdata to submit form to database
const formData = new FormData()
formData.append('mda', mdaName)
formData.append('logo', file)
axios({
method: 'post',
url: 'https://aaerlaw.herokuapp.com/api/admin/mdas',
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
},
})
.then((res) => {
console.log(res)
alert.success('MDA added successfully')
setMdaName('')
setFile('')
})
.catch((err) => {
console.log(err)
})
}