Files
old-new-wiaas/frontend/src/reducers/coMarket/coMarketPackagesReducers.js
2018-10-16 06:45:28 +02:00

41 lines
978 B
JavaScript

import {
RECIEVE_SHOP_PACKAGES,
RECEIVE_SHOPS,
SELECT_SHOP,
REQUEST_SHOP_PACKAGES
} from '../../constants/coMarketConstants';
const moduleReducers = {};
moduleReducers[REQUEST_SHOP_PACKAGES] = (state, action) => {
return Object.assign({}, state, {
isLoading: action.isLoading
});
};
moduleReducers[RECIEVE_SHOP_PACKAGES] = (state, action) => {
return Object.assign({}, state, {
shopPackages: action.shopPackages,
isLoading: action.isLoading
});
};
moduleReducers[RECEIVE_SHOPS] = (state, action) => {
return Object.assign({}, state, {
shops: action.shops
});
};
moduleReducers[SELECT_SHOP] = (state, action) => {
return Object.assign({}, state, {
selectedShop: action.selectedShop
});
};
const coMarketPackagesReducer = (state = {}, action) => {
return moduleReducers[action.type] ? moduleReducers[action.type](state, action) : state;
};
export default coMarketPackagesReducer;