import {
  RESET_CLINIC_ID,
  SET_CLINIC_ID,
} from './logInAsClinicAdminActionType';

const initialState = {
  companyId: '',
};
const updateCompanyId = (state, payload) => ({
  ...state,
  ...payload,
});
const resetClinicId = (state) => ({
  ...state,
  ...initialState,
});

export default function (state = initialState, action) {
  switch (action.type) {
    case SET_CLINIC_ID:
      return updateCompanyId(state, action.payload);
    case RESET_CLINIC_ID:
      return resetClinicId(state);
    default:
      return state;
  }
}
