initial docker setup

This commit is contained in:
GotPPay
2018-06-14 16:49:28 +02:00
parent bc80b7342e
commit b5f87f27f8
3023 changed files with 985078 additions and 1 deletions

View File

@@ -0,0 +1,86 @@
import {
API_SERVER
} from '../../config';
import HtmlClient from '../../helpers/HtmlClient';
import {
REQUEST_SHOP_PACKAGES,
RECIEVE_SHOP_PACKAGES,
REQUEST_SHOP_COMMERCIAL_LEADS,
RECIEVE_SHOP_COMMERCIAL_LEADS,
SELECT_SHOP_COMMERCIAL_LEAD
} from '../../constants/coMarketConstants';
const client = new HtmlClient();
const requestShopPackages = () => ({
type: REQUEST_SHOP_PACKAGES,
isLoading: true
});
const recieveShopPackages = (json) => ({
type: RECIEVE_SHOP_PACKAGES,
isLoading: false,
shopPackages: json
});
export const fetchShopPackages = (cl, search) => {
return dispatch => {
dispatch(requestShopPackages());
return client.fetch({
url: `${API_SERVER}/coMarket/api/getShopPackages`,
method: 'post',
data: {
idCommercialLead: (cl && cl.value) || 0,
search
}
})
.then(response => {
if(response.data && response.data.packages){
dispatch(recieveShopPackages(response.data.packages))
}
})
.catch(error => {
client.onError(error, dispatch);
});
}
}
const requestShopCommercialLeads = () => ({
type: REQUEST_SHOP_COMMERCIAL_LEADS
});
const recieveShopCommercialLeads = (json) => ({
type: RECIEVE_SHOP_COMMERCIAL_LEADS,
commercialLeads: json
});
const generateClOptions = (commercialLeads) => {
commercialLeads.forEach((cl) => {
cl.value = cl.idCommercialLead;
cl.label = cl.commercialLeadName;
});
return commercialLeads;
}
export const fetchShopCommercialLeads = () => {
return dispatch => {
dispatch(requestShopCommercialLeads());
return client.fetch({url: `${API_SERVER}/coMarket/api/getAllCommercialLeads`})
.then(response => {
if(response.data && response.data.commercialLeads){
const clOptions = generateClOptions(response.data.commercialLeads);
dispatch(recieveShopCommercialLeads(clOptions));
if (clOptions.length) {
dispatch(selectCommercialLead(clOptions[0]));
dispatch(fetchShopPackages(clOptions[0]));
}
}
})
.catch(error => {
client.onError(error, dispatch);
});
}
}
export const selectCommercialLead = (cl) => ({
type: SELECT_SHOP_COMMERCIAL_LEAD,
selectedCommercialLead: cl
});