Hi!
I am having trouble with my routes. the react front end keeps giving me POST http://localhost:3000/api/review/ 422 (Unprocessable Entity)
when I try to submit reviews, and GET http://localhost:3000/api/review/movie/tt1825683 422 (Unprocessable Entity
when I try to get reviews by imdbID.
Here’s the part of my code that is giving me issues:
API.js
createReview: review => {
const data = {
data: review
}
return axios.post('/api/review/', data);
},
showMovieReviews: id => {
return axios.get('/api/review/movie/' + id);
},
showCommentsByReview: id => {
return axios.get('/api/comment/review/' + id);
}
Movie.jsx
componentDidMount() {
API.showMovieReviews(this.props.location.state.imdbID).then((reviews => {
API.showCommentsByReview(reviews.reviewId).then(comment => console.log("Success", comment)).catch(err => console.log(err));
})).catch(err => console.log(err));
}
I have uploaded the rest of my code here: https://github.com/BlackMG27/cinefile-r-us. Thanks in advance.