/* like mutation */
import ACTION from '../actions/actiontsTypes';

const initialState = {
    simpleGoodsData: {},
    isFetching: true,
    error: null
};

export default function (state = initialState, action) {
    switch (action.type) {
        case ACTION.SIMPLE_GOODS_BY_ID_REQUEST: {
            return {
                ...state,
                isFetching: true,
                error: null
            }
        }
        case ACTION.SIMPLE_GOODS_BY_ID_RESPONSE: {
            return {
                ...state,
                simpleGoodsData: action.data,
                isFetching: false,
                error: null
            }
        }
        case ACTION.SIMPLE_GOODS_BY_ID_ERROR: {
            return {
                ...state,
                error: action.error,
                isFetching: false
            }
        }
        default: {
            return state
        }
    }
}


