Last active
April 13, 2016 06:59
-
-
Save rommsen/1d9474043187fedfa3a25e2fc9b7e0b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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