BOD-14 WIP. CSS issues present with 2 way texting, but working live.
This commit is contained in:
@@ -7,12 +7,16 @@ const INITIAL_STATE = {
|
||||
{
|
||||
phone_num: "6049992002",
|
||||
id: "519ba10d-6467-4fa5-9c22-59ae891edeb6",
|
||||
open: false
|
||||
open: false,
|
||||
isSending: false,
|
||||
sendingError: null
|
||||
},
|
||||
{
|
||||
phone_num: "6049992991",
|
||||
id: "ab57deba-eeb9-40db-b5ae-23f3ce8d7c7b",
|
||||
open: false
|
||||
open: false,
|
||||
isSending: false,
|
||||
sendingError: null
|
||||
}
|
||||
],
|
||||
error: null
|
||||
@@ -30,6 +34,31 @@ const messagingReducer = (state = INITIAL_STATE, action) => {
|
||||
...state,
|
||||
visible: true
|
||||
};
|
||||
case MessagingActionTypes.SEND_MESSAGE:
|
||||
return {
|
||||
...state,
|
||||
conversations: state.conversations.map(c =>
|
||||
c.id === action.payload.conversationid ? { ...c, isSending: true } : c
|
||||
)
|
||||
};
|
||||
case MessagingActionTypes.SEND_MESSAGE_SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
conversations: state.conversations.map(c =>
|
||||
c.id === action.payload.conversationid
|
||||
? { ...c, isSending: false }
|
||||
: c
|
||||
)
|
||||
};
|
||||
case MessagingActionTypes.SEND_MESSAGE_FAILURE:
|
||||
return {
|
||||
...state,
|
||||
conversations: state.conversations.map(c =>
|
||||
c.id === action.payload.conversationid
|
||||
? { ...c, isSending: false, sendingError: action.payload.error }
|
||||
: c
|
||||
)
|
||||
};
|
||||
case MessagingActionTypes.OPEN_CONVERSATION:
|
||||
if (
|
||||
state.conversations.find(c => c.phone_num === action.payload.phone_num)
|
||||
@@ -48,7 +77,9 @@ const messagingReducer = (state = INITIAL_STATE, action) => {
|
||||
{
|
||||
phone_num: action.payload.phone_num,
|
||||
id: action.payload.id,
|
||||
open: true
|
||||
open: true,
|
||||
isSending: false,
|
||||
sendingError: null
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -66,8 +97,7 @@ const messagingReducer = (state = INITIAL_STATE, action) => {
|
||||
c.phone_num === action.payload ? { ...c, open: !c.open } : c
|
||||
)
|
||||
};
|
||||
case MessagingActionTypes.SEND_MESSAGE_FAILURE:
|
||||
return { ...state, error: action.payload };
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user