gab-social/app/javascript/gabsocial/reducers/popover.js

25 lines
530 B
JavaScript
Raw Normal View History

2020-02-28 15:20:47 +00:00
import Immutable from 'immutable'
import {
POPOVER_OPEN,
POPOVER_CLOSE,
} from '../actions/popover'
const initialState = Immutable.Map({
popoverType: null,
2020-04-08 02:06:59 +01:00
popoverProps: null,
2020-02-28 15:20:47 +00:00
})
export default function popoverMenu(state = initialState, action) {
switch (action.type) {
2020-04-08 02:06:59 +01:00
case POPOVER_OPEN:
return state.withMutations(map => {
map.set('popoverType', action.popoverType)
map.set('popoverProps', action.popoverProps)
})
case POPOVER_CLOSE:
return initialState
default:
return state
2020-02-28 15:20:47 +00:00
}
}