mirror of
https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
synced 2025-11-03 03:37:45 +00:00
Mounting,unmounting commands event listener
This commit is contained in:
@@ -95,10 +95,6 @@ const DeviceCommands = ({ selectedDeviceId }) => {
|
||||
});
|
||||
};
|
||||
|
||||
eventBus.on("actionCompleted", () =>
|
||||
getCommands()
|
||||
);
|
||||
|
||||
const deleteCommand = async () => {
|
||||
if (uuidDelete === '') {
|
||||
return false;
|
||||
@@ -196,6 +192,16 @@ const DeviceCommands = ({ selectedDeviceId }) => {
|
||||
}
|
||||
}, [selectedDeviceId, start, end]);
|
||||
|
||||
useEffect(() => {
|
||||
eventBus.on("actionCompleted", () =>
|
||||
getCommands()
|
||||
);
|
||||
|
||||
return () => {
|
||||
eventBus.remove("actionCompleted");
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedDeviceId) {
|
||||
setStart(addDays(new Date(), -3).toString());
|
||||
|
||||
Reference in New Issue
Block a user