const handleAddItem = event =>{
event.preventDefault()
const item = {
name: event.target.name.value,
description: event.target.name.value,
img: event.target.img,
category: event.target.category.value,
email: user.email,
quantity: event.target.quantity.value,
price: event.target.price.value,
suppName: event.target.supplierName.value
}
console.log(item);
axios.post('the Url', item)
.then(response => {
console.log(response)
const {data} = response;
if(data.insertedId){
alert('User Added Successfully')
event.target.reset();
}
})
This is my code and the qrror is shown when I try to post my array. Don't understand why happening. my backend is totally good. the title of the error is