1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-10-30 07:40:05 -04:00
moneygo/js/containers/AccountsTabContainer.js
Aaron Lindsay 25b04a4f0f Stop creating lists in containers
Create them only when needed in reducers instead
2017-06-21 21:27:41 -04:00

49 lines
2.3 KiB
JavaScript

var connect = require('react-redux').connect;
var SecurityActions = require('../actions/SecurityActions');
var AccountActions = require('../actions/AccountActions');
var TransactionActions = require('../actions/TransactionActions');
var ImportActions = require('../actions/ImportActions');
var AccountsTab = require('../components/AccountsTab');
function mapStateToProps(state) {
return {
accounts: state.accounts.map,
accountChildren: state.accounts.children,
securities: state.securities.map,
security_list: state.securities.list,
selectedAccount: state.selectedAccount,
transactions: state.transactions,
transactionPage: state.transactionPage,
imports: state.imports
}
}
function mapDispatchToProps(dispatch) {
return {
onFetchAllAccounts: function() {dispatch(AccountActions.fetchAll())},
onCreateAccount: function(account) {dispatch(AccountActions.create(account))},
onUpdateAccount: function(account) {dispatch(AccountActions.update(account))},
onDeleteAccount: function(account) {dispatch(AccountActions.remove(account))},
onSelectAccount: function(accountId) {dispatch(AccountActions.select(accountId))},
onFetchAllSecurities: function() {dispatch(SecurityActions.fetchAll())},
onCreateTransaction: function(transaction) {dispatch(TransactionActions.create(transaction))},
onUpdateTransaction: function(transaction) {dispatch(TransactionActions.update(transaction))},
onDeleteTransaction: function(transaction) {dispatch(TransactionActions.remove(transaction))},
onSelectTransaction: function(transactionId) {dispatch(TransactionActions.select(transactionId))},
onUnselectTransaction: function() {dispatch(TransactionActions.unselect())},
onFetchTransactionPage: function(account, pageSize, page) {dispatch(TransactionActions.fetchPage(account, pageSize, page))},
onOpenImportModal: function() {dispatch(ImportActions.openModal())},
onCloseImportModal: function() {dispatch(ImportActions.closeModal())},
onImportOFX: function(account, password, startDate, endDate) {dispatch(ImportActions.importOFX(account, password, startDate, endDate))},
onImportOFXFile: function(inputElement, account) {dispatch(ImportActions.importOFXFile(inputElement, account))},
onImportGnucash: function(inputElement) {dispatch(ImportActions.importGnucash(inputElement))},
}
}
module.exports = connect(
mapStateToProps,
mapDispatchToProps
)(AccountsTab)