limit number of orders
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
|||||||
RECEIVE_ORDERS
|
RECEIVE_ORDERS
|
||||||
} from '../../constants/dashboardConstants';
|
} from '../../constants/dashboardConstants';
|
||||||
import SaburlyAdapter from '../../helpers/SaburlyAdapter';
|
import SaburlyAdapter from '../../helpers/SaburlyAdapter';
|
||||||
|
import { MAX_ORDER_COUNT } from '../../constants/ordersConstants';
|
||||||
const htmlClient = new HtmlClient();
|
const htmlClient = new HtmlClient();
|
||||||
const saburlyAdapter = new SaburlyAdapter();
|
const saburlyAdapter = new SaburlyAdapter();
|
||||||
|
|
||||||
@@ -23,8 +24,8 @@ export const fetchOrders = (viewAllOrders) => {
|
|||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(requestOrders());
|
dispatch(requestOrders());
|
||||||
return htmlClient.fetch({
|
return htmlClient.fetch({
|
||||||
url: `${API_SERVER}/wp-json/wc/v2/orders`,
|
url: `${API_SERVER}/wp-json/wc/v2/orders?per_page=${MAX_ORDER_COUNT}`,
|
||||||
method: 'get'
|
method: 'get',
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
const transformedOrdersArray = saburlyAdapter.transformOrdersArray(response.data);
|
const transformedOrdersArray = saburlyAdapter.transformOrdersArray(response.data);
|
||||||
|
|||||||
@@ -207,3 +207,5 @@ export const orderTexts = {
|
|||||||
PLACED_BY: 'Placed by'
|
PLACED_BY: 'Placed by'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const MAX_ORDER_COUNT = 5;
|
||||||
|
|||||||
Reference in New Issue
Block a user