@@ -1,24 +1,24 @@
|
||||
import EmailActionTypes from "./email.types";
|
||||
|
||||
export const toggleEmailOverlayVisible = () => ({
|
||||
type: EmailActionTypes.TOGGLE_EMAIL_OVERLAY_VISIBLE
|
||||
type: EmailActionTypes.TOGGLE_EMAIL_OVERLAY_VISIBLE
|
||||
});
|
||||
|
||||
export const setEmailOptions = options => ({
|
||||
type: EmailActionTypes.SET_EMAIL_OPTIONS,
|
||||
payload: options
|
||||
type: EmailActionTypes.SET_EMAIL_OPTIONS,
|
||||
payload: options
|
||||
});
|
||||
|
||||
export const sendEmail = email => ({
|
||||
type: EmailActionTypes.SEND_EMAIL,
|
||||
payload: email
|
||||
type: EmailActionTypes.SEND_EMAIL,
|
||||
payload: email
|
||||
});
|
||||
|
||||
export const sendEmailSuccess = options => ({
|
||||
type: EmailActionTypes.SEND_EMAIL_SUCCESS
|
||||
type: EmailActionTypes.SEND_EMAIL_SUCCESS
|
||||
});
|
||||
|
||||
export const sendEmailFailure = error => ({
|
||||
type: EmailActionTypes.SEND_EMAIL_FAILURE,
|
||||
payload: error
|
||||
type: EmailActionTypes.SEND_EMAIL_FAILURE,
|
||||
payload: error
|
||||
});
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
import EmailActionTypes from "./email.types";
|
||||
|
||||
const INITIAL_STATE = {
|
||||
emailConfig: {
|
||||
messageOptions: {
|
||||
from: { name: "ShopName", address: "noreply@romeonline.io" },
|
||||
to: null,
|
||||
replyTo: null,
|
||||
emailConfig: {
|
||||
messageOptions: {
|
||||
from: {name: "ShopName", address: "noreply@romeonline.io"},
|
||||
to: null,
|
||||
replyTo: null,
|
||||
},
|
||||
template: {name: null, variables: {}},
|
||||
},
|
||||
template: { name: null, variables: {} },
|
||||
},
|
||||
|
||||
open: false,
|
||||
error: null,
|
||||
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;
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { all } from "redux-saga/effects";
|
||||
import {all} from "redux-saga/effects";
|
||||
// import { sendEmailFailure, sendEmailSuccess } from "./email.actions";
|
||||
// import { renderTemplate } from "../application/application.actions";
|
||||
// import EmailActionTypes from "./email.types";
|
||||
@@ -57,10 +57,10 @@ import { all } from "redux-saga/effects";
|
||||
// }
|
||||
|
||||
export function* emailSagas() {
|
||||
yield all([
|
||||
// call(onSendEmail),
|
||||
// call(onSendEmailFailure),
|
||||
// call(onSendEmailSuccess)
|
||||
//call(onSetEmailOptions),
|
||||
]);
|
||||
yield all([
|
||||
// call(onSendEmail),
|
||||
// call(onSendEmailFailure),
|
||||
// call(onSendEmailSuccess)
|
||||
//call(onSetEmailOptions),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { createSelector } from "reselect";
|
||||
import {createSelector} from "reselect";
|
||||
|
||||
const selectEmail = (state) => state.email;
|
||||
|
||||
export const selectEmailVisible = createSelector(
|
||||
[selectEmail],
|
||||
(email) => email.open
|
||||
[selectEmail],
|
||||
(email) => email.open
|
||||
);
|
||||
|
||||
export const selectEmailConfig = createSelector(
|
||||
[selectEmail],
|
||||
(email) => email.emailConfig
|
||||
[selectEmail],
|
||||
(email) => email.emailConfig
|
||||
);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const EmailActionTypes = {
|
||||
TOGGLE_EMAIL_OVERLAY_VISIBLE: "TOGGLE_EMAIL_OVERLAY_VISIBLE",
|
||||
SET_EMAIL_OPTIONS: "SET_EMAIL_OPTIONS",
|
||||
SEND_EMAIL: "SEND_EMAIL",
|
||||
SEND_EMAIL_SUCCESS: "SEND_EMAIL_SUCCESS",
|
||||
SEND_EMAIL_FAILURE: "SEND_EMAIL_FAILURE"
|
||||
TOGGLE_EMAIL_OVERLAY_VISIBLE: "TOGGLE_EMAIL_OVERLAY_VISIBLE",
|
||||
SET_EMAIL_OPTIONS: "SET_EMAIL_OPTIONS",
|
||||
SEND_EMAIL: "SEND_EMAIL",
|
||||
SEND_EMAIL_SUCCESS: "SEND_EMAIL_SUCCESS",
|
||||
SEND_EMAIL_FAILURE: "SEND_EMAIL_FAILURE"
|
||||
};
|
||||
export default EmailActionTypes;
|
||||
|
||||
Reference in New Issue
Block a user