import produce from "immer";
import { ACTIONS } from "./actions.js";
const initialState = {
  isOpen: null,
  message: "loading...",
  delay: true
};
const waitMessageReducer = (state = initialState, action) => produce(state, (draft) => {
  switch (action.type) {
    case ACTIONS.OPEN:
      draft.isOpen = true;
      draft.message = action.payload.message;
      draft.delay = action.payload.delay;
      break;
    case ACTIONS.CLOSE:
      draft.isOpen = false;
      break;
  }
});
export {
  initialState,
  waitMessageReducer
};
