Further work on async email modal. Correctly sending basic emails.
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user