limit number of orders

This commit is contained in:
GotPPay
2018-08-07 14:13:58 +02:00
parent 7725556f38
commit 5a06649406
2 changed files with 5 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import {
RECEIVE_ORDERS
} from '../../constants/dashboardConstants';
import SaburlyAdapter from '../../helpers/SaburlyAdapter';
import { MAX_ORDER_COUNT } from '../../constants/ordersConstants';
const htmlClient = new HtmlClient();
const saburlyAdapter = new SaburlyAdapter();
@@ -23,8 +24,8 @@ export const fetchOrders = (viewAllOrders) => {
return dispatch => {
dispatch(requestOrders());
return htmlClient.fetch({
url: `${API_SERVER}/wp-json/wc/v2/orders`,
method: 'get'
url: `${API_SERVER}/wp-json/wc/v2/orders?per_page=${MAX_ORDER_COUNT}`,
method: 'get',
})
.then(response => {
const transformedOrdersArray = saburlyAdapter.transformOrdersArray(response.data);

View File

@@ -207,3 +207,5 @@ export const orderTexts = {
PLACED_BY: 'Placed by'
}
};
export const MAX_ORDER_COUNT = 5;