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

const initialState = {
    responseStatus: '',
    isFetching: false,
    error: null
};

export default function (state = initialState, action) {
    switch (action.type) {
        case ACTION.ISSUE_ORDER_REQUEST: {
            return {
                ...state,
                isFetching: true,
                error: null
            }
        }
        case ACTION.ISSUE_ORDER_RESPONSE: {
            return {
                ...state,
                responseStatus: action.data,
                isFetching: false,
                error: null
            }
        }
        case ACTION.ISSUE_ORDER_ERROR: {
            return {
                ...state,
                error: action.error,
                isFetching: false
            }
        }
        default: {
            return state
        }
    }
}

