Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1640 | Rev 1644 | 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
 
1642 stevensc 13
  switch (type) {
14
    case [actionsTypes.CLOSE_MODAL]: {
15
      return { ...state, ...reportState }
1639 stevensc 16
    }
1642 stevensc 17
 
18
    case [actionsTypes.SHOW_MODAL]: {
19
      return {
20
        ...state,
21
        showModal: true,
22
        type: payload?.type,
23
        reportUrl: payload?.reportUrl,
24
        onComplete: payload?.onComplete
25
      }
26
    }
27
 
28
    default: {
29
      return state
30
    }
1639 stevensc 31
  }
32
}
33
 
1640 stevensc 34
export default reportReducer