Files
old-new-wiaas/frontend/src/reducers/coMarket/coMarketPackagesReducers.js

41 lines
978 B
JavaScript
Raw Normal View History

2018-06-14 16:49:28 +02:00
import {
RECIEVE_SHOP_PACKAGES,
2018-10-16 06:45:28 +02:00
RECEIVE_SHOPS,
SELECT_SHOP,
2018-06-14 16:49:28 +02:00
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
});
};
2018-10-16 06:45:28 +02:00
moduleReducers[RECEIVE_SHOPS] = (state, action) => {
2018-06-14 16:49:28 +02:00
return Object.assign({}, state, {
2018-10-16 06:45:28 +02:00
shops: action.shops
2018-06-14 16:49:28 +02:00
});
};
2018-10-16 06:45:28 +02:00
moduleReducers[SELECT_SHOP] = (state, action) => {
2018-06-14 16:49:28 +02:00
return Object.assign({}, state, {
2018-10-16 06:45:28 +02:00
selectedShop: action.selectedShop
2018-06-14 16:49:28 +02:00
});
};
const coMarketPackagesReducer = (state = {}, action) => {
return moduleReducers[action.type] ? moduleReducers[action.type](state, action) : state;
};
export default coMarketPackagesReducer;