Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1639 | Rev 1642 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1639 stevensc 1
import { actionsTypes } from './report.actions'
2
 
3
const reportState = {
4
  showModal: false,
5
  type: 'Publicación',
6
  reportUrl: '',
7
  onComplete: () => {}
8
}
9
 
1640 stevensc 10
const reportReducer = (state = reportState, action) => {
1639 stevensc 11
  const { type, payload } = action
12
 
13
  const actionCases = {
14
    [actionsTypes.CLOSE_MODAL]: {
15
      ...state,
16
      ...reportState
17
    },
18
    [actionsTypes.SHOW_MODAL]: {
19
      ...state,
20
      showModal: true,
21
      type: payload.type,
22
      reportUrl: payload.reportUrl,
23
      onComplete: payload.onComplete
24
    }
25
  }
26
 
27
  return actionCases[type] || state
28
}
29
 
1640 stevensc 30
export default reportReducer