feat: Show refresh modal on action cable disconnect (#4010)
This commit is contained in:
parent
ea3e011d3f
commit
80d83b401c
3 changed files with 12 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import { createConsumer } from '@rails/actioncable';
|
||||
import { BUS_EVENTS } from 'shared/constants/busEvents';
|
||||
|
||||
const PRESENCE_INTERVAL = 20000;
|
||||
|
||||
|
@ -18,6 +19,7 @@ class BaseActionCableConnector {
|
|||
this.perform('update_presence');
|
||||
},
|
||||
received: this.onReceived,
|
||||
disconnected: this.onDisconnected,
|
||||
}
|
||||
);
|
||||
this.app = app;
|
||||
|
@ -33,6 +35,11 @@ class BaseActionCableConnector {
|
|||
this.consumer.disconnect();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
onDisconnected() {
|
||||
window.bus.$emit(BUS_EVENTS.WEBSOCKET_DISCONNECT);
|
||||
}
|
||||
|
||||
onReceived = ({ event, data } = {}) => {
|
||||
if (this.isAValidEvent(data)) {
|
||||
if (this.events[event] && typeof this.events[event] === 'function') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue