Show notification when client got disconnected
This commit is contained in:
@@ -13,6 +13,7 @@ import { MqttOptions, DataSourceState } from '../../../backend/src/DataSource'
|
|||||||
import { showTree } from './Tree'
|
import { showTree } from './Tree'
|
||||||
import { TopicViewModel } from '../TopicViewModel'
|
import { TopicViewModel } from '../TopicViewModel'
|
||||||
import { showError } from './Global'
|
import { showError } from './Global'
|
||||||
|
import { globalActions } from '.';
|
||||||
|
|
||||||
export const connect = (options: MqttOptions, connectionId: string) => (dispatch: Dispatch<any>, getState: () => AppState) => {
|
export const connect = (options: MqttOptions, connectionId: string) => (dispatch: Dispatch<any>, getState: () => AppState) => {
|
||||||
dispatch(connecting(connectionId))
|
dispatch(connecting(connectionId))
|
||||||
@@ -41,6 +42,7 @@ const updateHealth = (dataSourceState: DataSourceState) => (dispatch: Dispatch<a
|
|||||||
state = 'connecting'
|
state = 'connecting'
|
||||||
} else if (!dataSourceState.connected) {
|
} else if (!dataSourceState.connected) {
|
||||||
state = 'offline'
|
state = 'offline'
|
||||||
|
dispatch(globalActions.showError('Disconnected from server'))
|
||||||
} else if (dataSourceState.connected) {
|
} else if (dataSourceState.connected) {
|
||||||
state = 'online'
|
state = 'online'
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user