cb22b396eb
Add SDK functions Co-authored-by: Sojan <sojan@pepalo.com>
25 lines
683 B
JavaScript
25 lines
683 B
JavaScript
import BaseActionCableConnector from '../../shared/helpers/BaseActionCableConnector';
|
|
|
|
class ActionCableConnector extends BaseActionCableConnector {
|
|
constructor(app, pubsubToken) {
|
|
super(app, pubsubToken);
|
|
this.events = {
|
|
'message.created': this.onMessageCreated,
|
|
};
|
|
}
|
|
|
|
onMessageCreated = data => {
|
|
this.app.$store.dispatch('conversation/addMessage', data);
|
|
};
|
|
}
|
|
|
|
export const refreshActionCableConnector = pubsubToken => {
|
|
window.chatwootPubsubToken = pubsubToken;
|
|
window.actionCable.disconnect();
|
|
window.actionCable = new ActionCableConnector(
|
|
window.WOOT_WIDGET,
|
|
window.chatwootPubsubToken
|
|
);
|
|
};
|
|
|
|
export default ActionCableConnector;
|