Refactor Conversation, Message API calls, store

This commit is contained in:
Pranav Raj Sreepuram
2019-10-27 19:01:59 +05:30
parent c21c839dca
commit 170f8716c5
13 changed files with 215 additions and 402 deletions

View File

@@ -148,10 +148,13 @@ export default {
if (messageHasOnlyNewLines) {
return;
}
const messageAction = this.isPrivate ? 'addPrivateNote' : 'sendMessage';
if (this.message.length !== 0 && !this.showCannedModal) {
this.$store
.dispatch(messageAction, [this.currentChat.id, this.message])
.dispatch('sendMessage', {
conversationId: this.currentChat.id,
message: this.message,
private: this.isPrivate,
})
.then(() => {
this.$emit('scrollToMessage');
});
@@ -202,15 +205,15 @@ export default {
markSeen() {
this.$store.dispatch('markSeen', {
inboxId: this.currentChat.inbox_id,
senderId: this.currentChat.meta.sender.id,
contactId: this.currentChat.meta.sender.id,
});
},
toggleTyping(flag) {
toggleTyping(status) {
this.$store.dispatch('toggleTyping', {
flag,
status,
inboxId: this.currentChat.inbox_id,
senderId: this.currentChat.meta.sender.id,
contactId: this.currentChat.meta.sender.id,
});
},
disableButton() {