Refactord email popup screen to use Redx + implement all email redux/saga scaffolding.

This commit is contained in:
Patrick Fic
2020-02-20 16:48:25 -08:00
parent b845e62070
commit cf461b0536
13 changed files with 322 additions and 118 deletions

View File

@@ -0,0 +1,35 @@
import EmailActionTypes from "./email.types";
const INITIAL_STATE = {
emailConfig: {
messageOptions: {
from: { name: "ShopName", address: "noreply@bodyshop.app" },
to: null,
replyTo: null
},
template: null,
queryConfig: [null, { variables: null }]
},
visible: false,
error: null
};
const emailReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case EmailActionTypes.TOGGLE_EMAIL_OVERLAY_VISIBLE:
return {
...state,
visible: !state.visible
};
case EmailActionTypes.SET_EMAIL_OPTIONS:
return {
...state,
emailConfig: { ...action.payload }
};
default:
return state;
}
};
export default emailReducer;