Update socket api

This commit is contained in:
jeffvli
2022-11-16 19:52:55 -08:00
parent 04b45e26cd
commit c89808fd14
+13 -6
View File
@@ -1,9 +1,16 @@
import { io } from 'socket.io-client';
import { useAuthStore } from '@/renderer/store';
const { username } = JSON.parse(
localStorage.getItem('store_authentication') || '{}'
).state.permissions;
export const socket = io('http://localhost:8843', {
query: { username },
export const socket = io(useAuthStore.getState().serverUrl, {
query: {
id: useAuthStore.getState().permissions.id,
username: useAuthStore.getState().permissions.username,
},
reconnection: true,
reconnectionAttempts: 10,
reconnectionDelay: 500,
});
socket.emit('join', {
id: useAuthStore.getState().permissions.id,
});