aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
Diffstat (limited to 'modern')
-rw-r--r--modern/src/SocketController.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/modern/src/SocketController.js b/modern/src/SocketController.js
index 49874ba7..87b842fa 100644
--- a/modern/src/SocketController.js
+++ b/modern/src/SocketController.js
@@ -45,15 +45,19 @@ const SocketController = () => {
socket.onclose = async (event) => {
dispatch(sessionActions.updateSocket(false));
if (event.code !== logoutCode) {
- const devicesResponse = await fetch('/api/devices');
- if (devicesResponse.ok) {
- dispatch(devicesActions.update(await devicesResponse.json()));
- }
- const positionsResponse = await fetch('/api/positions', {
- headers: { 'Content-Type': 'application/json' },
- });
- if (positionsResponse.ok) {
- dispatch(positionsActions.update(await positionsResponse.json()));
+ try {
+ const devicesResponse = await fetch('/api/devices');
+ if (devicesResponse.ok) {
+ dispatch(devicesActions.update(await devicesResponse.json()));
+ }
+ const positionsResponse = await fetch('/api/positions', {
+ headers: { 'Content-Type': 'application/json' },
+ });
+ if (positionsResponse.ok) {
+ dispatch(positionsActions.update(await positionsResponse.json()));
+ }
+ } catch (error) {
+ // ignore errors
}
setTimeout(() => connectSocket(), 60000);
}