From 5a0664940633015a4f981bcc9f852fd97e48c6c9 Mon Sep 17 00:00:00 2001 From: GotPPay Date: Tue, 7 Aug 2018 14:13:58 +0200 Subject: [PATCH] limit number of orders --- frontend/src/actions/dashboard/ordersActions.js | 5 +++-- frontend/src/constants/ordersConstants.js | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/actions/dashboard/ordersActions.js b/frontend/src/actions/dashboard/ordersActions.js index 15d3592..c9315c1 100644 --- a/frontend/src/actions/dashboard/ordersActions.js +++ b/frontend/src/actions/dashboard/ordersActions.js @@ -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); diff --git a/frontend/src/constants/ordersConstants.js b/frontend/src/constants/ordersConstants.js index 6b1f69d..91a2e42 100644 --- a/frontend/src/constants/ordersConstants.js +++ b/frontend/src/constants/ordersConstants.js @@ -207,3 +207,5 @@ export const orderTexts = { PLACED_BY: 'Placed by' } }; + +export const MAX_ORDER_COUNT = 5;