We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am using axios and trying to post to localhost:3000/posts and getting this error above. Here is the code:
import axios from 'axios'; import { GET_ALL_POSTS, GET_POST, CREATE_POST, DELETE_POST, UPDATE_POST } from './types'; const ROOT_URL = 'http://localhost:3000'; export function createPost({content, title}, cb) { return function(dispatch) { axios.post(`${ROOT_URL}/posts`, {content, title}) .then((response) => { console.log(response); dispatch({ type: CREATE_POST, payload: response }); }) .then(() => cb()) .catch((error) => { if(error.response) { console.log(error.response); } console.log("Problem submitting New Post", error); }); } }
The text was updated successfully, but these errors were encountered:
Hey, Request failed with status code 400 means that request was created, but server returned response with HTTP code 400 (Bad Request).
Request failed with status code 400
Sorry, something went wrong.
I'm closing this PR as it doesn't seem an issue in Axios but in your web server.
User redux thunk(Middleware) where you can apply asynchronous logics
No branches or pull requests
I am using axios and trying to post to localhost:3000/posts and getting this error above. Here is the code:
The text was updated successfully, but these errors were encountered: