import { TYPE_OPEN_ALERT, TYPE_CLOSE_ALERT } from "../types"; const initialState = { open: false, title: "", body: "", noCB: undefined, yesCB: undefined, yesText: "", noText: "", yesButtonOnly: false, noButtonOnly: false, theme: undefined, children: undefined, backdropCancellable: true } export function alertReducer(state = initialState, action) { switch(action.type) { case TYPE_OPEN_ALERT: return Object.assign({}, state, { ...action.payload }); case TYPE_CLOSE_ALERT: return Object.assign({}, state, { ...initialState }); default: return state } }