Rev 1639 | Rev 1642 | 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
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 reportReducer