Rename isGetCustomersError to getCustomersError

This commit is contained in:
Albert Juhé Lluveras 2018-12-15 13:09:47 +01:00
parent 346ed578ae
commit 41c48126bf
2 changed files with 7 additions and 7 deletions

View File

@ -177,7 +177,7 @@ export default class CustomersReportTable extends Component {
endpoint="customers"
extendItemsMethodNames={ {
load: 'getCustomers',
isError: 'isGetCustomersError',
isError: 'getCustomersError',
isRequesting: 'isGetCustomersRequesting',
} }
getHeadersContent={ this.getHeadersContent }

View File

@ -20,6 +20,11 @@ const getCustomers = ( getResource, requireResource ) => (
return ids.map( id => getResource( getResourceName( 'customer', id ) ).data || {} );
};
const getCustomersError = getResource => ( query = {} ) => {
const resourceName = getResourceName( 'customers-query', query );
return getResource( resourceName ).error;
};
const isGetCustomersRequesting = getResource => ( query = {} ) => {
const resourceName = getResourceName( 'customers-query', query );
const { lastRequested, lastReceived } = getResource( resourceName );
@ -31,13 +36,8 @@ const isGetCustomersRequesting = getResource => ( query = {} ) => {
return lastRequested > lastReceived;
};
const isGetCustomersError = getResource => ( query = {} ) => {
const resourceName = getResourceName( 'customers-query', query );
return getResource( resourceName ).error;
};
export default {
getCustomers,
getCustomersError,
isGetCustomersRequesting,
isGetCustomersError,
};