import { CLASE_FETCH_SUCCESS, CLASE_FETCH_FAIL, CLASE_FETCH } from '../actions/types'; const INITIAL_STATE = { curClase: { profesor: {} }, loading: true, error: false }; export default (state = INITIAL_STATE, action) => { switch (action.type) { case CLASE_FETCH: return { ...state, curClase: { error: false }, loading: true }; case CLASE_FETCH_SUCCESS: return { ...state, loading: false, curClase: action.payload }; case CLASE_FETCH_FAIL: return { ...state, loading: false, curClase: { error: true } }; default: return state; } };