Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1647 | | Comparar con el anterior | Ultima modificación | Ver Log |

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