score:1
afaik, dispatching action is synchronous so you can't await it. so the issue is coming from your dispatching part. it should be fixed if you do something like this
export const createentity: icrudputaction<realm> = entity => async dispatch => {
const result = await axios.post(apiurl, cleanentity(entity));
dispatch({
type: action_types.create_realm,
payload: result.data,
});
dispatch(getentities());
return result;
};
you need await for your api call to finish then dispatch an action which is sync call. and 4xx errors occur when it's a client side error, so you need to check your post data format, headers, etc because of which the server might reject your request with error.
Source: stackoverflow.com
Related Query
- How to make a rest post call from ReactJS code?
- make http post request with reactJs and NodeJs
- How to make Post Request using ReactJS
- ReactJS: Trying to make a POST
- Trying to make a sub page (channel) in reactjs
- I am getting an error while trying to make a POST request of the "workout" object
- Hi I am trying to make a post request to my json server but getting unexpected results
- I'm trying to make a POST request to get receive access token, however I'm receiving undefined. How can I resolve this please?
- how to make post request by axios with multiple parameters in Reactjs
- Make Material-UI Reactjs FloatingActionButton float
- How to properly make REST calls from ReactJS + Redux application?
- How to make Puppeteer work with a ReactJS application on the client-side
- When should ReactJS components make AJAX calls to update state from props?
- In ReactJS trying to get params but I get property 'id' does not exist on type '{}'
- Syntax Error "Expecting expression, got '<'" while trying to run reactjs tutorial
- Trying to implement a SIMPLE promise in Reactjs
- How to make a table in ReactJS sortable?
- How to do POST in FORM Submit using reactjs and pass the object value into REST service?
- ReactJS - Handle POST requests using react router dom
- reactjs make https (not http) requests with axios
- Axios Post Form with Reactjs
- Where to make an Initial AJAX request from in ReactJS
- Is there a way to make ReactJs SEO friendly without using Next or Gatsby?
- Error: SSL connect error on Insomnia when trying to make a localhost request
- Trying to create a typing effect on reactjs
- this.setState is not a function ( trying Upload Image) ReactJs
- How to send POST data to flask using Reactjs fetch
- Trying to render a new instance in ReactJS
- ReactJS AXIOS post doesn't work
- How to make Auto Slides Per View with dynamic content using Swiper Reactjs
More Query from same tag
- jest/enzyme test: this.props.showOverlay is not a function
- Multiple params with React Router
- How do I prevent a function from being run before data is loaded into this.state (i.e. in componentDidMount)?
- How to format a cell in react material-ui DataGrid
- Override RSS feed styling in React
- getting error : void' is not assignable to type 'FC<IPickWinnerProps>' in react js
- Cleaner way to change focus on child components in React
- Set the result of ajax in react
- JSX skip if JSON field does not exist
- React Bootstrap custom checkbox without id?
- Dynamically select React component and apply data as props
- How to create dynamic form input fields in React with ANTd
- How to deselect all while using react-selectable-fast
- Why state is not declared when it was set properly?
- React/Redux: Is there a way to clear react date-picker when it's incorporated with redux-form?
- How to add email validation to below code?
- Organizing React app in component/container
- Mocking cross-fetch
- React.js: Rendering Components from Array of Objects
- How can I see the other users information when I click the button?
- Why template of one component extends template of another component?
- Targeting specific Lottie animations on hover with lottie-web in React
- Detect focus on children component with react
- Why is the app not re-rendering even if the state has changed?
- Incorrect dependency behavior in hook useEffect?
- Recharts grouping x-axis Labels
- React URL changes but component does not render
- react helper import fails in production but works in development
- React Fetch Request returning data is undefined
- Is there a way to render multiple React components in the React.render() function?