mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import { getResourceViews } from 'store/customViews/customViews.selectors';
|
|
import {
|
|
getCustomerCurrentPageFactory,
|
|
getCustomerPaginationMetaFactory,
|
|
getCustomerTableQueryFactory,
|
|
getCustomersCurrentViewIdFactory,
|
|
} from 'store/customers/customers.selectors';
|
|
|
|
export default (mapState) => {
|
|
const getCustomersList = getCustomerCurrentPageFactory();
|
|
const getCustomerPaginationMeta = getCustomerPaginationMetaFactory();
|
|
const getCustomersCurrentViewId = getCustomersCurrentViewIdFactory();
|
|
const getCustomerTableQuery = getCustomerTableQueryFactory();
|
|
|
|
const mapStateToProps = (state, props) => {
|
|
const query = getCustomerTableQuery(state, props);
|
|
|
|
const mapped = {
|
|
customers: getCustomersList(state, props, query),
|
|
customersViews: getResourceViews(state, props, 'customers'),
|
|
customersTableQuery: query,
|
|
customerPagination: getCustomerPaginationMeta(state, props, query),
|
|
customersLoading: state.customers.loading,
|
|
customersItems: state.customers.items,
|
|
customersCurrentViewId: getCustomersCurrentViewId(state, props),
|
|
// customerErrors: state.customers.errors,
|
|
};
|
|
return mapState ? mapState(mapped, state, props) : mapped;
|
|
};
|
|
|
|
return connect(mapStateToProps);
|
|
};
|