Reputation: 501
i have tried to perform axios.delete
operation in react, unfortunately it is not working
, please help me to solve this issue,
export function DeletePatient(token,deletePatient) {
return axios.delete('/patient/billing_delete',deletePatient, {
headers: {
'Content-Type': 'application/json',
'token': token
}
})
.then(res => { console.log(token); return res.data })
.catch(err => { console.log(err); return err })
}
from my API response
, i understood that my token
is passed to backend
, so i think i should change the structure of this code, please help me
Upvotes: 3
Views: 10804
Reputation: 36199
the configuration object should come as second argument:
return axios.delete('/patient/billing_delete', {
headers: {
'Content-Type': 'application/json',
'token': token
},
data: deletePatient
})
Upvotes: 9