import { combineReducers } from 'redux';
import { getSuccessActionType } from '../utils';
import { getErrorReducer, getStatusReducer } from './utils/generators';
import { FETCH_STUDENT_DECKS } from '../constants/student-deck';

function data(state = {}, action) {
  switch (action.type) {
    case getSuccessActionType(FETCH_STUDENT_DECKS):
      return action.payload;

    default:
      return state;
  }
}

export default combineReducers({
  status: getStatusReducer([FETCH_STUDENT_DECKS]),
  error: getErrorReducer([FETCH_STUDENT_DECKS]),
  data
});
