import {
    REQUEST_ORDER_PROJECTS,
    RECEIVE_ORDER_PROJECTS
} from '../../constants/orderProjectsConstants';

const moduleReducers = {};

moduleReducers[REQUEST_ORDER_PROJECTS] = (state, action) => {
    return Object.assign({}, state, {
        isLoading: action.isLoading
    });
};

moduleReducers[RECEIVE_ORDER_PROJECTS] = (state, action) => {
    return Object.assign({}, state, {
        orderProjects: action.orderProjects,
        isLoading: action.isLoading
    });
};

const orderPackagesReducer = (state = {}, action) => {

    return moduleReducers[action.type] ? moduleReducers[action.type](state, action) : state;
};

export default orderPackagesReducer;
