import * as types from "../../constants/index"; import initialState from '../initialState'; export default function getUser(state = initialState.getUser, {type, payload: data, error }) { switch (type) { case types.USER_GET_REQUEST: { return { ...state, isFetching: true } } case types.USER_GET_REQUEST_SUCCESS: { return { ...state, isFetching: false, data } } case types.USER_GET_REQUEST_FAILURE: { return { ...state, isFetching: false, error } } default: { return state } } }