Poprawiono error handling socketów

This commit is contained in:
2022-07-06 15:14:24 +02:00
parent 2f4a65be07
commit 1530cf52af
4 changed files with 17 additions and 2 deletions
+7
View File
@@ -334,6 +334,12 @@ export const useStore = defineStore('store', {
transports: ['websocket', 'polling'],
rememberUpgrade: true,
reconnection: true,
timeout: 10000
});
socket.on('connect_error', (err) => {
this.dataStatuses.connection = DataStatus.Error;
this.webSocket = undefined;
});
socket.on('UPDATE', (data: APIData) => {
@@ -347,6 +353,7 @@ export const useStore = defineStore('store', {
});
this.webSocket = socket;
this.dataStatuses.connection = DataStatus.Loaded;
},
async connectToAPI() {