Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3183 Rev 3719
Línea 1... Línea 1...
1
import { shareModalActionTypes } from './shareModal.types'
1
import { shareModalActionTypes } from './shareModal.types';
2
 
2
 
3
const InitialState = {
3
const InitialState = {
4
  isOpen: false,
4
  isOpen: false,
5
  postUrl: '',
5
  postUrl: '',
6
  modalType: '',
6
  modalType: '',
7
  feedType: '',
7
  feedType: '',
8
  feedSharedId: ''
8
  feedSharedId: ''
9
}
9
};
10
 
10
 
11
const { OPEN_MODAL, CLOSE_MODAL } = shareModalActionTypes
11
const { OPEN_MODAL, CLOSE_MODAL } = shareModalActionTypes;
12
 
12
 
13
const shareModalReducer = (state = InitialState, { type, payload }) => {
13
const shareModalReducer = (state = InitialState, { type, payload }) => {
14
  switch (type) {
14
  switch (type) {
15
    case OPEN_MODAL: {
15
    case OPEN_MODAL: {
16
      return {
16
      return {
17
        ...state,
17
        ...state,
18
        isOpen: true,
18
        isOpen: true,
19
        feedSharedId: payload.feed_unique,
19
        feedSharedId: payload.feed_unique,
20
        ...payload
20
        ...payload
21
      }
21
      };
22
    }
22
    }
23
    case CLOSE_MODAL: {
23
    case CLOSE_MODAL: {
24
      return { ...state, isOpen: false }
24
      return { ...state, isOpen: false };
25
    }
25
    }
26
    default: {
26
    default: {
27
      return state
27
      return state;
28
    }
28
    }
29
  }
29
  }
30
}
30
};
31
 
31
 
32
export default shareModalReducer
32
export default shareModalReducer;