import { fromJS } from 'immutable';
import {
  CREATE_CUSTOM_ROW_REQUEST,
  CREATE_CUSTOM_ROW_SUCCESS,
  CREATE_CUSTOM_ROW_FAILURE,
} from './constants';

const initialState = fromJS({
  saveRowRequest: false,
});

function beeEditorReducer(state = initialState, action) {
  switch (action.type) {
    case CREATE_CUSTOM_ROW_REQUEST:
      return state.set('saveRowRequest', true);
    case CREATE_CUSTOM_ROW_SUCCESS:
      return state.set('saveRowRequest', false);
    case CREATE_CUSTOM_ROW_FAILURE:
      return state.set('saveRowRequest', false);
    default:
      return state;
  }
}

export default beeEditorReducer;
