bigbuffet-rw/app/soapbox/reducers/modal.js
marcin mikołajczak b0477ac1e1 fix broken modals
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-01-07 00:50:32 +01:00

23 lines
547 B
JavaScript

import { MODAL_OPEN, MODAL_CLOSE } from '../actions/modal';
const initialState = {
modalType: null,
modalProps: {},
noPop: false,
};
export default function modal(state = initialState, action) {
switch(action.type) {
case MODAL_OPEN:
return { modalType: action.modalType, modalProps: action.modalProps };
case MODAL_CLOSE:
return {
...(action.modalType === undefined || action.modalType === state.modalType)
? initialState
: state,
noPop: !!action.noPop,
};
default:
return state;
}
}