apply changes from order helper
This commit is contained in:
@@ -4,10 +4,9 @@ import {
|
|||||||
REQUEST_ORDERS,
|
REQUEST_ORDERS,
|
||||||
RECEIVE_ORDERS
|
RECEIVE_ORDERS
|
||||||
} from '../../constants/dashboardConstants';
|
} from '../../constants/dashboardConstants';
|
||||||
import SaburlyAdapter from '../../helpers/SaburlyAdapter';
|
import {fromWCOrder} from '../../helpers/OrderHelper';
|
||||||
import { MAX_ORDER_COUNT } from '../../constants/ordersConstants';
|
import { MAX_ORDER_COUNT } from '../../constants/ordersConstants';
|
||||||
const htmlClient = new HtmlClient();
|
const htmlClient = new HtmlClient();
|
||||||
const saburlyAdapter = new SaburlyAdapter();
|
|
||||||
|
|
||||||
export const requestOrders = () => ({
|
export const requestOrders = () => ({
|
||||||
type: REQUEST_ORDERS,
|
type: REQUEST_ORDERS,
|
||||||
@@ -28,8 +27,10 @@ export const fetchOrders = (viewAllOrders) => {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
const transformedOrdersArray = saburlyAdapter.transformOrdersArray(response.data);
|
const transformedFromWCOrders = response.data.map(order=>{
|
||||||
dispatch(recieveOrders(transformedOrdersArray));
|
return fromWCOrder(order);
|
||||||
|
});
|
||||||
|
dispatch(recieveOrders(transformedFromWCOrders));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
htmlClient.onError(error, dispatch);
|
htmlClient.onError(error, dispatch);
|
||||||
|
|||||||
Reference in New Issue
Block a user