BOD-14 Backend server work + sending of messages WIP for front end

This commit is contained in:
Patrick Fic
2020-03-25 15:50:46 -07:00
parent 5b5ffe21cd
commit 84a5820d8d
32 changed files with 892 additions and 274 deletions

View File

@@ -1,5 +1,23 @@
import { all } from "redux-saga/effects";
import { all, call, put, takeLatest } from "redux-saga/effects";
import { sendMessageFailure } from "./messaging.actions";
import MessagingActionTypes from "./messaging.types";
import axios from "axios";
export function* onSendMessage() {
yield takeLatest(MessagingActionTypes.SEND_MESSAGE, sendMessage);
}
export function* sendMessage(payload) {
try {
console.log("Message Contents", payload);
axios.post("/sms/send", payload).then(response => {
console.log(JSON.stringify(response));
});
} catch (error) {
console.log("Error in sendMessage saga.");
yield put(sendMessageFailure(error));
}
}
export function* messagingSagas() {
yield all([]);
yield all([call(onSendMessage)]);
}