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:
Dave Richer
2024-11-18 10:11:41 -08:00
parent 27de849be7
commit ae0bfad89a
7 changed files with 1283 additions and 2297 deletions

View File

@@ -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