I have this delete function that when user click it will push the id into delete array. User can delete multiple picture by click one by one icon trash. And to save thier commit changes about the delete item they have to click on the save button. But I have problem in sending the data in the form append.
output that I want to achieve is it will send the id the format like this
But currently it only send like this
How do I fix this problem to make sure that I can achieve output in append form like this ?
Use the function
JSON.stringify to the array. In your case :
or else you could just do
deleteDoc.forEach((item) => formData.append("deleted_attachment", item));