1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-10-30 15:50:04 -04:00
moneygo/js/containers/AccountsTabContainer.js

34 lines
1.0 KiB
JavaScript
Raw Normal View History

2016-10-05 13:36:47 -04:00
var connect = require('react-redux').connect;
var AccountActions = require('../actions/AccountActions');
var AccountsTab = require('../components/AccountsTab');
2016-10-05 13:36:47 -04:00
function mapStateToProps(state) {
var security_list = [];
for (var securityId in state.securities) {
if (state.securities.hasOwnProperty(securityId))
security_list.push(state.securities[securityId]);
}
return {
accounts: state.accounts.map,
accountChildren: state.accounts.children,
securities: state.securities,
security_list: security_list,
selectedAccount: state.selectedAccount
}
}
function mapDispatchToProps(dispatch) {
return {
onCreateAccount: function(account) {dispatch(AccountActions.create(account))},
onUpdateAccount: function(account) {dispatch(AccountActions.update(account))},
onDeleteAccount: function(accountId) {dispatch(AccountActions.remove(accountId))},
onSelectAccount: function(accountId) {dispatch(AccountActions.select(accountId))}
}
}
module.exports = connect(
mapStateToProps,
mapDispatchToProps
)(AccountsTab)