Work on wiaas orders

This commit is contained in:
Almira Krdzic
2018-08-08 12:21:26 +02:00
parent c1834f679a
commit b8653ad18b
25 changed files with 644 additions and 81 deletions

View File

@@ -23,12 +23,10 @@ export const getActiveOrders = () => {
return dispatch => {
dispatch(requestActiveOrders());
return htmlClient.fetch({
url: `${API_SERVER}/orders/api/getActiveOrders`
url: `${API_SERVER}/wp-json/wc/v2/orders?status=processing`
})
.then(response => {
if (typeof response.data !== 'undefined' && 'orders' in response.data) {
dispatch(recieveActiveOrders(response.data.orders));
}
dispatch(recieveActiveOrders(response.data));
})
.catch(error => {
htmlClient.onError(error, dispatch);
@@ -50,12 +48,10 @@ export const getHistoryOrders = () => {
return dispatch => {
dispatch(requestHistoryOrders());
return htmlClient.fetch({
url: `${API_SERVER}/orders/api/getHistoryOrders`
url: `${API_SERVER}/wp-json/wc/v2/orders?status=completed`
})
.then(response => {
if (typeof response.data !== 'undefined' && 'orders' in response.data) {
dispatch(recieveHistoryOrders(response.data.orders));
}
dispatch(recieveHistoryOrders(response.data));
})
.catch(error => {
htmlClient.onError(error, dispatch);