File tree Expand file tree Collapse file tree 2 files changed +1
-20
lines changed Expand file tree Collapse file tree 2 files changed +1
-20
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { MqttClient } from 'mqtt-browser';
33import invariant from 'tiny-warning' ;
44
55import { ERROR_MESSAGES } from './constants.util' ;
6- import { isValidTopic } from './isValidTopic.util' ;
76
87const hasStore = ( store : Store | null ) => {
98 const isValid = store !== null ;
@@ -21,22 +20,9 @@ const isClientConnected = (client: MqttClient | null) => {
2120 return client ?. connected ;
2221} ;
2322
24- const hasAllValidTopics = ( topics : string | string [ ] ) => {
25- const isValid = Array . isArray ( topics )
26- ? topics . every ( ( topic ) => isValidTopic ( topic ) )
27- : isValidTopic ( topics ) ;
28-
29- if ( ! isValid ) invariant ( false , ERROR_MESSAGES . NO_VALID_TOPICS ) ;
30-
31- return isValid ;
32- } ;
33-
3423export const shouldSubscribeOrUnsubscribe = (
35- topics : string | string [ ] ,
3624 store : Store | null ,
3725 client : MqttClient | null ,
3826) => {
39- return (
40- hasAllValidTopics ( topics ) && hasStore ( store ) && isClientConnected ( client )
41- ) ;
27+ return hasStore ( store ) && isClientConnected ( client ) ;
4228} ;
You can’t perform that action at this time.
0 commit comments