import { combineReducers } from 'redux'

const data = (state = {}, action) => {
  switch (action.type) {
    case 'FETCH_REGISTRATION_SUCCESS':
      return action.payload
    case 'SIGN_OUT_SUCCESS':
      return {}
    default:
      return state
  }
}

const isFetching = (state = false, action) => {
  switch (action.type) {
    case 'FETCH_REGISTRATION_REQUEST':
      return true
    case 'FETCH_REGISTRATION_SUCCESS':
    case 'FETCH_ERROR':
      return false
    default:
      return state
  }
}

export default combineReducers({
  data,
  isFetching
})
