aboutsummaryrefslogtreecommitdiff
path: root/modern/src/SocketController.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/SocketController.jsx')
-rw-r--r--modern/src/SocketController.jsx8
1 files changed, 8 insertions, 0 deletions
diff --git a/modern/src/SocketController.jsx b/modern/src/SocketController.jsx
index 7dd073fd..fe39d2b7 100644
--- a/modern/src/SocketController.jsx
+++ b/modern/src/SocketController.jsx
@@ -20,6 +20,7 @@ const SocketController = () => {
const authenticated = useSelector((state) => !!state.session.user);
const devices = useSelector((state) => state.devices.items);
+ const includeLogs = useSelector((state) => state.session.includeLogs);
const socketRef = useRef();
@@ -76,9 +77,16 @@ const SocketController = () => {
}
setEvents(data.events);
}
+ if (data.logs) {
+ dispatch(sessionActions.updateLogs(data.logs));
+ }
};
};
+ useEffect(() => {
+ socketRef.current?.send(JSON.stringify({ logs: includeLogs }));
+ }, [socketRef, includeLogs]);
+
useEffectAsync(async () => {
if (authenticated) {
const response = await fetch('/api/devices');