import { PROFILE_CLEAR, PROFILE_MINE_SET, PROFILE_SET } from "../../actions/profile/profileActionConstants";
import createReducer from "../../utils/createReducer";

const initialState = {
  profile: {},
  mineProfile: {},
};

export default createReducer(
  {
    [PROFILE_SET]: setProfile,
    [PROFILE_MINE_SET]: setMineProfile,
    [PROFILE_CLEAR]: clearProfile,
  },
  initialState
);

function setProfile(state, action) {
  return {
    ...state,
    profile: action.payload,
  };
}
function setMineProfile(state, action) {
  return {
    ...state,
    mineProfile: action.payload
  }
}
function clearProfile() {
  return initialState;
}
