Skip to content

Instantly share code, notes, and snippets.

@rommsen
Last active April 13, 2016 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rommsen/1d9474043187fedfa3a25e2fc9b7e0b0 to your computer and use it in GitHub Desktop.
Save rommsen/1d9474043187fedfa3a25e2fc9b7e0b0 to your computer and use it in GitHub Desktop.
import React from "react";
import {connect} from "react-redux";
import {routeActions} from "react-router-redux";
import {makePayment} from "./memberActions";
import MakePaymentForm from "./MakePaymentForm";
const MakePayment = ({onMakePayment, params: {id}}) => {
return (
<div className="container">
<div className="row">
<div className="col-xs-12 col-sm-12 col-md-6 col-lg-6 col-md-offset-3 col-lg-offset-3">
<MakePaymentForm onMakePayment={onMakePayment} member_id={id}/>
</div>
</div>
</div>
);
};
function mapDispatchToProps(dispatch) {
return {
onMakePayment: (member_id, amount, date) => {
dispatch(makePayment(member_id, amount, date));
dispatch(routeActions.push('/members'));
},
}
}
export default connect(({members}) => ({members}), mapDispatchToProps)(MakePayment);
import React from "react";
import {connect} from "react-redux";
import {routeActions} from "react-router-redux";
import {makePayment} from "./memberActions";
import MakePaymentForm from "./MakePaymentForm";
const MakePayment = ({onMakePayment}) => {
return (
<div className="container">
<div className="row">
<div className="col-xs-12 col-sm-12 col-md-6 col-lg-6 col-md-offset-3 col-lg-offset-3">
<MakePaymentForm onMakePayment={onMakePayment}/>
</div>
</div>
</div>
);
};
function mapDispatchToProps(dispatch, ownProps) {
return {
onMakePayment: (amount, date) => {
dispatch(makePayment(ownProps.params.id, amount, date));
dispatch(routeActions.push('/members'));
},
}
}
export default connect(({members}) => ({members}), mapDispatchToProps)(MakePayment);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment