Further work on async email modal. Correctly sending basic emails.

This commit is contained in:
Patrick Fic
2020-02-20 17:23:56 -08:00
parent cf461b0536
commit 1344198447
7 changed files with 111 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
import { all, call, put, takeLatest } from "redux-saga/effects";
import { sendEmailFailure, sendEmailSuccess } from "./email.actions";
import EmailActionTypes from "./email.types";
import axios from "axios";
export function* onSendEmail() {
yield takeLatest(EmailActionTypes.SEND_EMAIL, sendEmail);
@@ -8,10 +9,10 @@ export function* onSendEmail() {
export function* sendEmail(payload) {
try {
console.log("Sending thta email", payload);
// // axios.post("/sendemail", emailConfig).then(response => {
// alert(JSON.stringify(response));
// });
yield put(sendEmailSuccess());
axios.post("/sendemail", payload).then(response => {
console.log(JSON.stringify(response));
put(sendEmailSuccess());
});
} catch (error) {
console.log("Error in sendEmail saga.");
yield put(sendEmailFailure(error.message));