2016-10-05 13:36:47 -04:00
|
|
|
var connect = require('react-redux').connect;
|
|
|
|
|
|
|
|
var UserActions = require('../actions/UserActions');
|
2018-11-02 21:15:33 -04:00
|
|
|
var AccountActions = require('../actions/AccountActions');
|
|
|
|
var TransactionActions = require('../actions/TransactionActions');
|
2017-06-21 21:25:38 -04:00
|
|
|
var SecurityTemplateActions = require('../actions/SecurityTemplateActions');
|
2016-10-05 13:36:47 -04:00
|
|
|
|
2016-10-05 13:45:09 -04:00
|
|
|
var MoneyGoApp = require('../components/MoneyGoApp');
|
2016-10-05 13:36:47 -04:00
|
|
|
|
|
|
|
function mapStateToProps(state) {
|
|
|
|
return {
|
2018-11-02 21:15:33 -04:00
|
|
|
user: state.user,
|
|
|
|
accounts: state.accounts.map,
|
|
|
|
accountChildren: state.accounts.children,
|
|
|
|
selectedAccount: state.selectedAccount,
|
|
|
|
security_list: state.securities.list,
|
2016-10-05 13:36:47 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
|
|
return {
|
|
|
|
tryResumingSession: function() {dispatch(UserActions.tryResumingSession())},
|
2017-06-21 21:25:38 -04:00
|
|
|
fetchCurrencies: function() {dispatch(SecurityTemplateActions.fetchCurrencies())},
|
2018-11-02 21:15:33 -04:00
|
|
|
onCreateAccount: function(account) {dispatch(AccountActions.create(account))},
|
|
|
|
onSelectAccount: function(accountId) {dispatch(AccountActions.select(accountId))},
|
|
|
|
onFetchTransactionPage: function(account, pageSize, page) {dispatch(TransactionActions.fetchPage(account, pageSize, page))},
|
2016-10-05 13:36:47 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = connect(
|
|
|
|
mapStateToProps,
|
|
|
|
mapDispatchToProps
|
|
|
|
)(MoneyGoApp)
|