UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

11 lines (10 loc) 485 B
import { useChatContext } from '../../../context/ChatContext'; export const useEditMessageHandler = (doUpdateMessageRequest) => { const { channel, client } = useChatContext('useEditMessageHandler'); return (updatedMessage, options) => { if (doUpdateMessageRequest && channel) { return Promise.resolve(doUpdateMessageRequest(channel.cid, updatedMessage, options)); } return client.updateMessage(updatedMessage, undefined, options); }; };