BOD-14 Backend server work + sending of messages WIP for front end
This commit is contained in:
@@ -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)]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user