Added messaging presets BOD-107

This commit is contained in:
Patrick Fic
2020-07-21 16:12:32 -07:00
parent 0ef4d77275
commit 7b99a2e612
21 changed files with 526 additions and 18 deletions

View File

@@ -27,4 +27,9 @@ export const setSelectedConversation = (conversationId) => ({
export const openChatByPhone = (phoneNumber) => ({
type: MessagingActionTypes.OPEN_CHAT_BY_PHONE,
payload: phoneNumber,
});
export const setMessage = (message) => ({
type: MessagingActionTypes.SET_MESSAGE,
payload: message,
});

View File

@@ -5,10 +5,13 @@ const INITIAL_STATE = {
selectedConversationId: null,
isSending: false,
error: null,
message: null,
};
const messagingReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case MessagingActionTypes.SET_MESSAGE:
return { ...state, message: action.payload };
case MessagingActionTypes.TOGGLE_CHAT_VISIBLE:
return {
...state,
@@ -29,6 +32,7 @@ const messagingReducer = (state = INITIAL_STATE, action) => {
case MessagingActionTypes.SEND_MESSAGE_SUCCESS:
return {
...state,
message: "",
isSending: false,
};
case MessagingActionTypes.SEND_MESSAGE_FAILURE:

View File

@@ -21,3 +21,8 @@ export const selectSelectedConversation = createSelector(
[selectMessaging],
(messaging) => messaging.selectedConversationId
);
export const selectMessage = createSelector(
[selectMessaging],
(messaging) => messaging.message
);

View File

@@ -5,5 +5,6 @@ const MessagingActionTypes = {
SEND_MESSAGE_FAILURE: "SEND_MESSAGE_FAILURE",
SET_SELECTED_CONVERSATION: "SET_SELECTED_CONVERSATION",
OPEN_CHAT_BY_PHONE: "OPEN_CHAT_BY_PHONE",
SET_MESSAGE: "SET_MESSAGE",
};
export default MessagingActionTypes;