Here the delete function
const DeletePost = (id) => {
console.log(id);
axios.delete(`${BASE_URL}/futureevents/delete/${id}`)
.then(res => {
console.log("success");
})
.catch(err => {
console.log(err);
})
}
console log display id ,but ID not going to backend. When I use postmen, then work properly. what is the error in above function?
error is /
.
not need /
after ${BASE_URL}
because end of my BASE_URL already have /
.
BASE_URL = "http://192.168.204.74:3000/api/v1/"
before fixed
axios.delete(`${BASE_URL}/futureevents/delete/${id}`)
after fixed
axios.delete(`${BASE_URL}futureevents/delete/${id}`)