Added messaging presets BOD-107
This commit is contained in:
@@ -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,
|
||||
});
|
||||
@@ -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:
|
||||
|
||||
@@ -21,3 +21,8 @@ export const selectSelectedConversation = createSelector(
|
||||
[selectMessaging],
|
||||
(messaging) => messaging.selectedConversationId
|
||||
);
|
||||
|
||||
export const selectMessage = createSelector(
|
||||
[selectMessaging],
|
||||
(messaging) => messaging.message
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user