Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1647 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

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