import * as ActionTypes from '../actionTypes'
import { UserRobotImageDispatchTypes } from './types'

const initialState: string | null = null

const reducer = (
  state = initialState,
  action: UserRobotImageDispatchTypes
): string | null | undefined => {
  switch (action.type) {
    case ActionTypes.SET_USER_ROBOT_IMAGE:
      return action.payload

    case ActionTypes.RESTORE_STATE:
      return action.payload.userRobotImage

    default:
      return state
  }
}

export default reducer
