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

@@ -56,14 +56,14 @@ export const receiveCustomerDetails = (json) => ({
export const fetchCartCount = () => {
return dispatch => {
dispatch(requestShopCartCount());
return client.fetch({url: `${API_SERVER}/cart/api/getCartCount`}).then(response => {
dispatch(receiveShopCartCount(0));
/*return client.fetch({url: `${API_SERVER}/cart/api/getCartCount`}).then(response => {
if (typeof response.data !== 'undefined' && 'cartItemsCount' in response.data) {
dispatch(receiveShopCartCount(response.data.cartItemsCount));
}
}).catch(error => {
client.onError(error, dispatch);
});
});*/
}
}

View File

@@ -12,16 +12,7 @@ const recieveGadgets = (json) => ({
export const fetchGadgets = () => {
return dispatch => {
dispatch(requestGadgets());
return htmlClient.fetch({
url: `${API_SERVER}/dashboards/api/getMyDashboard`
})
.then(response => {
if(response.data && response.data.gadgets){
dispatch(recieveGadgets(response.data.gadgets))
}
})
.catch(error => {
htmlClient.onError(error, dispatch);
});
const data = {"info":{"idDashboard":"23","name":"Customer Basic Dashboard","isOwner":"0"},"gadgets":[{"idGadget":"3","name":"Customer Order Central","module":"gadget-order-central","position":"1"},{"idGadget":"5","name":"Customer Next Actions","module":"gadget-next-actions","position":"2"}]};
dispatch(recieveGadgets(data.gadgets))
}
}

View File

@@ -18,7 +18,7 @@ export const fetchNextActions = () => {
return dispatch => {
dispatch(requestNextActions());
return client.fetch({
url: `${API_SERVER}/dashboards/api/getNextActionsInfo`
url: `${API_SERVER}/wp-json/wiaas/next-delivery-steps`
})
.then(response => dispatch(recieveNextActions(response.data)))
.catch(error => {

View File

@@ -19,8 +19,8 @@ export const recieveOrders = (json) => ({
export const fetchOrders = (viewAllOrders) => {
return dispatch => {
dispatch(requestOrders());
return htmlClient.fetch({
dispatch(recieveOrders([]));
/*return htmlClient.fetch({
url: `${API_SERVER}/dashboards/api/getOrderCentralInfo`,
method: 'post',
data: {
@@ -30,6 +30,6 @@ export const fetchOrders = (viewAllOrders) => {
.then(response => dispatch(recieveOrders(response.data)))
.catch(error => {
htmlClient.onError(error, dispatch);
});
});*/
}
}

View File

@@ -160,8 +160,68 @@ const validateRefreshToken = () => {
export const getModules = () => {
return dispatch => {
const data = {
"modules": {
"modules": [
{
"id": "14",
"name": "ProfileSettings",
"menuName": "ProfileSettings",
"url": "profileSettings",
"isInMenu": "0"
},
{
"id": "23",
"name": "OrderProjects",
"menuName": "OrderProjects",
"url": "orderProjects",
"isInMenu": "0"
},
{
"id": "15",
"name": "Terms",
"menuName": "Terms",
"url": "terms",
"isInMenu": "0"
},
{
"id": "19",
"name": "Cart",
"menuName": "Cart",
"url": "cart",
"isInMenu": "0"
},
{
"id": "1",
"name": "Dashboards",
"menuName": "Overview",
"url": "dashboards",
"isInMenu": "1"
},
{
"id": "18",
"name": "CoMarket",
"menuName": "Co-Market",
"url": "co-market",
"isInMenu": "1"
}
],
"subModules": {
"co-market": [
{
"moduleUrl": "co-market",
"menuName": "Orders",
"name": "Orders",
"url": "orders"
}
]
}
}
};
dispatch(recieveModules(data));
dispatch(requestModules());
return htmlClient.fetch({
/**return htmlClient.fetch({
url: `${API_SERVER}/login/api/getModules`,
})
.then(response => {
@@ -169,7 +229,7 @@ export const getModules = () => {
})
.catch(error => {
htmlClient.onError(error, dispatch);
});
});**/
}
}

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);