So, I have been trying to delete a particular object's property with axios and used axios.delete(url).. I used this function inside a onClick operator.
It was Like this ->
const deleteFromMyItems = async () => {
const url = `http://localhost:5000/myItems/${_id}`;
const ok = window.confirm('Are you sure?');
if (ok) {
await axios.delete(url, {
headers: {
authorization: `Bearer ${localStorage.getItem('accessToken')}`
}
})
await axios.delete(`http://localhost:5000/laptops/${_id}`)
}
}
but the problem is that It only deletes one of them...... I want to delete both together....