2020-04-08 02:06:59 +01:00
|
|
|
import Immutable from 'immutable'
|
|
|
|
import {
|
|
|
|
MODAL_OPEN,
|
|
|
|
MODAL_CLOSE,
|
|
|
|
} from '../actions/modal'
|
2019-07-02 08:10:25 +01:00
|
|
|
|
2020-04-08 02:06:59 +01:00
|
|
|
const initialState = Immutable.Map({
|
2019-07-02 08:10:25 +01:00
|
|
|
modalType: null,
|
2020-04-08 02:06:59 +01:00
|
|
|
modalProps: null,
|
|
|
|
})
|
2019-07-02 08:10:25 +01:00
|
|
|
|
|
|
|
export default function modal(state = initialState, action) {
|
|
|
|
switch(action.type) {
|
|
|
|
case MODAL_OPEN:
|
2020-04-08 02:06:59 +01:00
|
|
|
return state.withMutations(map => {
|
|
|
|
map.set('modalType', action.modalType)
|
|
|
|
map.set('modalProps', action.modalProps)
|
|
|
|
})
|
2019-07-02 08:10:25 +01:00
|
|
|
case MODAL_CLOSE:
|
2020-04-08 02:06:59 +01:00
|
|
|
return initialState
|
2019-07-02 08:10:25 +01:00
|
|
|
default:
|
2020-04-08 02:06:59 +01:00
|
|
|
return state
|
2019-07-02 08:10:25 +01:00
|
|
|
}
|
2020-04-08 02:06:59 +01:00
|
|
|
}
|