Skip to content

Instantly share code, notes, and snippets.

@jamigibbs
Last active March 31, 2020 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamigibbs/eaf0ca6e0b6c9f318ee44acd2a72e9b5 to your computer and use it in GitHub Desktop.
Save jamigibbs/eaf0ca6e0b6c9f318ee44acd2a72e9b5 to your computer and use it in GitHub Desktop.
Enter and leave chat
handleEnterChat() {
setUserChatActive()
.then((res) => {
this.isChatActive = res.Chat_Active__c;
this._socket.emit('userEnteredChat');
return refreshApex(this.wiredChatUsers);
})
.catch(error => {
// eslint-disable-next-line no-console
console.error('handleEnterChat error', error);
this.error = 'Error updating user record';
});
}
handleLeaveChat() {
setUserChatInactive()
.then((res) => {
this.isChatActive = res.Chat_Active__c;
this._socket.emit('userLeftChat');
return refreshApex(this.wiredChatUsers);
})
.catch(error => {
// eslint-disable-next-line no-console
console.error('handleLeaveChat error', error);
this.error = 'Error updating user record';
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment