Fix : Customers

This commit is contained in:
elforjani3
2020-11-10 13:31:54 +02:00
parent 027c1af841
commit eef1c3c7e1
15 changed files with 393 additions and 190 deletions

View File

@@ -1,17 +1,27 @@
import { connect } from 'react-redux';
import { getCustomersItems, getCustomersListFactory } from 'store/customers/customers.selectors';
import { getResourceViews } from 'store/customViews/customViews.selectors';
import {
getCustomerCurrentPageFactory,
getCustomerPaginationMetaFactory,
getCustomerTableQueryFactory,
} from 'store/customers/customers.selectors';
export default (mapState) => {
const getCustomersList = getCustomersListFactory();
const getCustomersList = getCustomerCurrentPageFactory();
const getCustomerPaginationMeta = getCustomerPaginationMetaFactory();
const getCustomerTableQuery = getCustomerTableQueryFactory();
const mapStateToProps = (state, props) => {
const query = getCustomerTableQuery(state, props);
const mapped = {
customers: getCustomersList(state, props, query),
customersViews: getResourceViews(state, props, 'customers'),
customersItems: getCustomersList(state, props),
customers: getCustomersItems(state, state.customers.currentViewId),
customersTableQuery: query,
customerPagination: getCustomerPaginationMeta(state, props, query),
customersLoading: state.customers.loading,
customerErrors: state.customers.errors,
customersItems: state.customers.items,
// customerErrors: state.customers.errors,
};
return mapState ? mapState(mapped, state, props) : mapped;
};