Skip to content

Instantly share code, notes, and snippets.

@jamigibbs
Created March 30, 2020 20:23
Show Gist options
  • Select an option

  • Save jamigibbs/11324b5c192462c40e074745a024c823 to your computer and use it in GitHub Desktop.

Select an option

Save jamigibbs/11324b5c192462c40e074745a024c823 to your computer and use it in GitHub Desktop.
lwc output
this._socket.on('output', (data) => {
if (data) {
const fields = {};
fields[CONTENT_FIELD.fieldApiName] = data.message;
fields[USER_FIELD.fieldApiName] = this.userId;
const message = { apiName: MESSAGE_OBJECT.objectApiName, fields };
createRecord(message)
.then(() => {
this._socket.emit('transmit');
return refreshApex(this.wiredMessages);
})
.catch(error => {
// eslint-disable-next-line no-console
console.error('error', error);
this.error = 'Error creating message';
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment