BOD-14 WIP. CSS issues present with 2 way texting, but working live.

This commit is contained in:
Patrick Fic
2020-03-26 17:03:22 -07:00
parent a507e40816
commit f80f96f3df
19 changed files with 244 additions and 160 deletions

View File

@@ -1,20 +1,22 @@
import { all, call, put, takeLatest } from "redux-saga/effects";
import { sendMessageFailure } from "./messaging.actions";
import { sendMessageFailure, sendMessageSuccess } from "./messaging.actions";
import MessagingActionTypes from "./messaging.types";
import axios from "axios";
import { sendEmailFailure } from "../email/email.actions";
export function* onSendMessage() {
yield takeLatest(MessagingActionTypes.SEND_MESSAGE, sendMessage);
}
export function* sendMessage({ payload }) {
console.log("In the saga.");
try {
console.log("Message Contents", payload);
axios.post("/sms/send", payload).then(response => {
console.log(JSON.stringify(response));
});
const response = yield call(axios.post, "/sms/send", payload);
if (response.status === 200) {
yield put(sendMessageSuccess(payload));
} else {
yield put(sendEmailFailure(response.data));
}
} catch (error) {
console.log("Error in sendMessage saga.");
console.log("Error in sendMessage saga.", error);
yield put(sendMessageFailure(error));
}
}