Refactord email popup screen to use Redx + implement all email redux/saga scaffolding.
This commit is contained in:
35
client/src/redux/email/email.reducer.js
Normal file
35
client/src/redux/email/email.reducer.js
Normal 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;
|
||||
Reference in New Issue
Block a user