Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1645 | 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 reportReducer = (state = reportState, action) => {
  const { type, payload } = action

  switch (type) {
    case actionsTypes.CLOSE_MODAL: {
      return { ...state, ...reportState }
    }

    case actionsTypes.SHOW_MODAL: {
      const { type, reportUrl, onComplete } = payload

      return {
        ...state,
        type,
        reportUrl,
        onComplete,
        showModal: true
      }
    }

    default: {
      return state
    }
  }
}

export default reportReducer