hello I have an error when I activate my like button, I use react and axios.
const likeHandle = async () => {
const data = {
userId: JSON.parse(localStorage.getItem("user")).user,
postId: JSON.parse(localStorage.getItem("post"))._id,
};
const like = { like : JSON.parse(localStorage.getItem("post")).likes }
console.log(data)
await axios.post('http://localhost:4200/api/post/'+ data.postId + '/like/',
{userId : data.userId, like: like ? 1 : 0 } ).pipe(
mapTo(like),
catchError(error => throwError(error.error.message)))
};