mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-19 18:04:22 +02:00
Update socket api
This commit is contained in:
@@ -1,9 +1,16 @@
|
|||||||
import { io } from 'socket.io-client';
|
import { io } from 'socket.io-client';
|
||||||
|
import { useAuthStore } from '@/renderer/store';
|
||||||
|
|
||||||
const { username } = JSON.parse(
|
export const socket = io(useAuthStore.getState().serverUrl, {
|
||||||
localStorage.getItem('store_authentication') || '{}'
|
query: {
|
||||||
).state.permissions;
|
id: useAuthStore.getState().permissions.id,
|
||||||
|
username: useAuthStore.getState().permissions.username,
|
||||||
export const socket = io('http://localhost:8843', {
|
},
|
||||||
query: { username },
|
reconnection: true,
|
||||||
|
reconnectionAttempts: 10,
|
||||||
|
reconnectionDelay: 500,
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.emit('join', {
|
||||||
|
id: useAuthStore.getState().permissions.id,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user