override missing modules using hardcoded values

This commit is contained in:
GotPPay
2018-07-29 02:28:44 +02:00
parent 09a2be6be8
commit d2ff1e497a
4 changed files with 85 additions and 6 deletions

View File

@@ -57,6 +57,9 @@ export const receiveCustomerDetails = (json) => ({
export const fetchCartCount = () => {
return dispatch => {
dispatch(requestShopCartCount());
//TODO : fetch cart count from woocommerce (requires plugin)
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));
@@ -64,6 +67,7 @@ export const fetchCartCount = () => {
}).catch(error => {
client.onError(error, dispatch);
});
*/
}
}

View File

@@ -1,7 +1,4 @@
import {API_SERVER} from '../../config';
import HtmlClient from '../../helpers/HtmlClient';
import {REQUEST_GADGETS, RECIEVE_GADGETS} from '../../constants/dashboardConstants';
const htmlClient = new HtmlClient();
const requestGadgets = () => ({type: REQUEST_GADGETS});
const recieveGadgets = (json) => ({
@@ -12,6 +9,19 @@ const recieveGadgets = (json) => ({
export const fetchGadgets = () => {
return dispatch => {
dispatch(requestGadgets());
//TODO : check how to solve gadgets, don't use hardcoded values
const gadgets = [
{
name: 'CustomerOrderCentral',
idGadget: 0,
},
{
name: 'CustomerNextActions',
idGadget: 1,
}
]
dispatch(recieveGadgets(gadgets));
/*
return htmlClient.fetch({
url: `${API_SERVER}/dashboards/api/getMyDashboard`
})
@@ -23,5 +33,6 @@ export const fetchGadgets = () => {
.catch(error => {
htmlClient.onError(error, dispatch);
});
*/
}
}

View File

@@ -1,7 +1,4 @@
import {API_SERVER} from '../../config';
import HtmlClient from '../../helpers/HtmlClient';
import {REQUEST_NEXT_ACTIONS, RECIEVE_NEXT_ACTIONS} from '../../constants/dashboardConstants';
const client = new HtmlClient();
export const requestNextActions = () => ({
type: REQUEST_NEXT_ACTIONS,
@@ -17,6 +14,9 @@ export const recieveNextActions = (json) => ({
export const fetchNextActions = () => {
return dispatch => {
dispatch(requestNextActions());
//TODO : fetch next actions from gravity flow api
dispatch(recieveNextActions({}));
/*
return client.fetch({
url: `${API_SERVER}/dashboards/api/getNextActionsInfo`
})
@@ -24,5 +24,6 @@ export const fetchNextActions = () => {
.catch(error => {
client.onError(error, dispatch);
});
*/
}
}

View File

@@ -161,6 +161,68 @@ const validateRefreshToken = () => {
export const getModules = () => {
return dispatch => {
dispatch(requestModules());
//TODO : check how to solve modules, don't hardocde values
const modules={
modules:{
modules:[
{
id:"19",
isInMenu:"0",
menuName:"Cart",
name:"Cart",
url:"cart",
},
{
id:"14",
isInMenu:"0",
menuName:"ProfileSettings",
name:"ProfileSettings",
url:"profileSettings",
},
{
id:"23",
isInMenu:"0",
menuName:"OrderProjects",
name:"OrderProjects",
url:"orderProjects",
},
{
id:"15",
isInMenu:"0",
menuName:"Terms",
name:"Terms",
url:"terms",
},
{
id:"1",
isInMenu:"1",
menuName:"Overview",
name:"Dashboards",
url:"dashboards",
},
{
id:"18",
isInMenu:"1",
menuName:"Co-Market",
name:"CoMarket",
url:"co-market",
}
],
subModules:{
"co-market":[
{
menuName:"Orders",
name:"Orders",
url:"orders",
moduleUrl:"co-market",
}
]
}
}
}
dispatch(recieveModules(modules));
/*
return htmlClient.fetch({
url: `${API_SERVER}/login/api/getModules`,
})
@@ -170,6 +232,7 @@ export const getModules = () => {
.catch(error => {
htmlClient.onError(error, dispatch);
});
*/
}
}