Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return dispatch => {
CometChat.sendMessage(textMessage).then(
message => {
return dispatch(updateMessage(uid, message, "sendText"));
},
error => {
console.log("mesage callback error : " + JSON.stringify(error));
}
);
};
} else {
return dispatch => {
CometChat.sendMessage(mediaMessage).then(
message => {
return dispatch(updateMessage(uid, message, "sendText"));
},
error => {
console.log("mesage callback error : " + JSON.stringify(error));
}
);
};
};
receiverID = this.props.activeConversation.uid;
receiverType = CometChat.RECEIVER_TYPE.USER;
}
var messageText = this.state.newMessage;
var textMessage = new CometChat.TextMessage(
receiverID,
messageText,
CometChat.MESSAGE_TYPE.TEXT,
receiverType
);
if (this.state.editingMessageActive === true) {
this.handleMessageUpdate(receiverID, receiverType, messageText);
} else {
CometChat.sendMessage(textMessage).then(
message => {
this.setState({
newMessage: [],
msghistory: [...this.state.msghistory, message]
});
this.scrollToBottom();
this.props.handleOnRecentMessageSent(message.id);
},
error => {
this.setState({ newMessage: [] });
}
);
}
}