feature/IO-3000-Migrate-MSG-to-Sockets - Add Conversation, merge master, packages
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -76,6 +76,11 @@ const useSocket = (bodyshop) => {
|
||||
dispatch({ type: "ADD_MESSAGE", payload: message });
|
||||
};
|
||||
|
||||
const handleNewConversation = (data) => {
|
||||
dispatch({ type: "ADD_CONVERSATION", payload: data.conversation });
|
||||
dispatch({ type: "ADD_MESSAGE", payload: data.message });
|
||||
};
|
||||
|
||||
const handleReadUpdated = ({ conversationId }) => {
|
||||
dispatch({ type: "UPDATE_UNREAD_COUNT", payload: conversationId });
|
||||
};
|
||||
@@ -88,6 +93,7 @@ const useSocket = (bodyshop) => {
|
||||
socketInstance.on("connect_error", handleConnectionError);
|
||||
socketInstance.on("disconnect", handleDisconnect);
|
||||
socketInstance.on("bodyshop-message", handleBodyshopMessage);
|
||||
socketInstance.on("new-conversation", handleNewConversation);
|
||||
}
|
||||
} else {
|
||||
// User is not authenticated
|
||||
|
||||
Reference in New Issue
Block a user