Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1640 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import { actionsTypes } from './report.actions'

const reportState = {
  showModal: false,
  type: 'Publicación',
  reportUrl: '',
  onComplete: () => {}
}

const AuthReducer = (state = reportState, action) => {
  const { type, payload } = action

  const actionCases = {
    [actionsTypes.CLOSE_MODAL]: {
      ...state,
      ...reportState
    },
    [actionsTypes.SHOW_MODAL]: {
      ...state,
      showModal: true,
      type: payload.type,
      reportUrl: payload.reportUrl,
      onComplete: payload.onComplete
    }
  }

  return actionCases[type] || state
}

export default AuthReducer