Files
bodyshop/client/src/redux/email/email.reducer.js
Dave Richer 4eb8faa5d9 - the great reformat
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-02-06 18:23:46 -05:00

36 lines
854 B
JavaScript

import EmailActionTypes from "./email.types";
const INITIAL_STATE = {
emailConfig: {
messageOptions: {
from: {name: "ShopName", address: "noreply@romeonline.io"},
to: null,
replyTo: null,
},
template: {name: null, variables: {}},
},
open: false,
error: null,
};
const emailReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case EmailActionTypes.TOGGLE_EMAIL_OVERLAY_VISIBLE:
return {
...state,
open: !state.open,
};
case EmailActionTypes.SET_EMAIL_OPTIONS:
return {
...state,
emailConfig: {...action.payload},
open: true,
};
default:
return state;
}
};
export default emailReducer;