function req2(data) {
return async dispatch => {
...
};
}
export const getReq = data => (
async dispatch => {
try {
dispatch({
type: types.GET_REQUEST,
});
const res = await api.getReq(data);
dispatch({
type: types.GET_SUCCESS,
payload: res,
});
dispatch(req2(res));
} catch (error) {
dispatch({
type: types.GET_ERROR,
});
}
}
);
var sell = [
{"breed": "sosna", "size": "20x100x6000", "cost": 1500},
{"breed": "sosna", "size": "30x100x6000", "cost": 2500},
{"breed": "sosna", "size": "40x100x6000", "cost": 3500},
{"breed": "sosna", "size": "20x100x6000", "cost": 4500},
{"breed": "sosna", "size": "30x100x6000", "cost": 5500},
{"breed": "sosna", "size": "40x100x6000", "cost": 6500},
];
var breed = ["sosna"];
var size = ["30x100x6000", "20x100x6000"];
var params = { breed, size };
var activeKeys = Object.keys(params).filter(function(key) {
return params[key].length;
});
var filtered = sell.filter(function(x) {
return activeKeys.every(function(key) {
return params[key].includes(x[key]);
});
});
const sell = [
{"breed": "sosna", "size": "20x100x6000", "cost": 1500},
{"breed": "sosna", "size": "30x100x6000", "cost": 2500},
{"breed": "sosna", "size": "40x100x6000", "cost": 3500},
{"breed": "sosna", "size": "20x100x6000", "cost": 4500},
{"breed": "sosna", "size": "30x100x6000", "cost": 5500},
{"breed": "sosna", "size": "40x100x6000", "cost": 6500},
];
const breed = ["sosna"];
const size = ["30x100x6000", "20x100x6000"];
const params = { breed, size };
const activeKeys = Object.keys(params).filter(key => params[key].length);
const filtered = auto.filter(x => activeKeys.every(key => params[key].includes(x[key])));