mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-01 20:08:39 -04:00
Hook (almost) everything up to Redux
This commit is contained in:
33
js/containers/AccountsTabContainer.js
Normal file
33
js/containers/AccountsTabContainer.js
Normal file
@ -0,0 +1,33 @@
|
||||
var connect = require('react-redux').connect;
|
||||
|
||||
var AccountActions = require('../actions/AccountActions');
|
||||
var AccountsTab = require('../AccountsTab');
|
||||
|
||||
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)
|
Reference in New Issue
Block a user