i am a little bit new to django rest and react , well i'am trying to update my buying form and change the state but i keep getting a bad request and getting in the response:
error:The submitted data was not a file. Check the encoding type on the form
my request:
const accept=()=> {
const token = localStorage.getItem('token')
var config = {
headers: {
'Authorization': "Token " + token,
'Content-Type': 'multipart/form-data'
}
}
const data = form
data.state="semi_approved"
const formdata = new FormData()
Object.keys(data).forEach(key => {
console.log(key+':',form[key])
formdata.append(key,form[key])
})
console.log(formdata)
axios.put(`${getForm}${match.params.id}/`,formdata,config).then(res => {
console.log(res.data)
})
}