I am using react-redux to do the api call. problem is how can i get the reuslt of the action once it is executed when saving/inserting new row
class AddServiceForm extends Component {
handleSaveBtnClick = () => {
const { columns, onSave } = this.props;
let params = new URLSearchParams();
this.props.addServices(params) // i need to find out result of this action???
};
render() {
const {
onModalClose,
onSave,
columns,
validateState,
ignoreEditable
} = this.props;
//const { columns, validateState } = this.props;
return (
<div className="modal-content">
//modal form
</div>
);
}
}
function mapStateToProps(state) {
return {
servicesAdd: state.servicesAdd
};
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(
{ addServices },
dispatch
);
}
The code is online https://codesandbox.io/s/o5430k7p4z and file in question is components/services/index.js