//instead of
axios.put(url, { foo: "bar" });
//wrap the data in the data propery of a new object
axios.delete(url, { data: { foo: "bar" } });
import axios from "axios";
/// DELETE REQUEST
handleDeleteById(id).then((res) => {
alert("deleted")
});
function handleDeleteById(id) {
// console.log(data);
// {name: "mysore", population: 11111, country: "India"}
return axios({
baseURL: "baseURL",
url: `/${id}`,
method: "DELETE"
});
}
axios.delete(url, { data: { foo: "bar" }, headers: { "Authorization": "***" } });
//Delete contacts
const deleteContctOf = (person) => {
console.log(person)
console.log('delete contact ' + person.id + ' ????')
if (window.confirm("Do you really want to delete this person")) {
contactService
.remove(person.id)
.setPersons(persons.map(person => person.id !=== id))
this solved the question
} else {
return
}
}