Loading packages/client/src/lib/network.ts +5 −8 Original line number Diff line number Diff line Loading @@ -46,14 +46,11 @@ type SentEventValue<K extends keyof INetworkEvents> = EventEmitter.ArgumentMap< >[Extract<K, keyof INetworkEvents>]; class Network extends EventEmitter<INetworkEvents> { socket: Socket<ServerToClientEvents, ClientToServerEvents> = io( import.meta.env.VITE_API_HOST, { socket: Socket<ServerToClientEvents, ClientToServerEvents> = io("", { autoConnect: false, withCredentials: true, reconnection: true, } ); }); private online_count = 0; private stateEvents: { [key in keyof INetworkEvents]?: SentEventValue<key>; Loading packages/client/src/lib/utils.ts +1 −3 Original line number Diff line number Diff line Loading @@ -40,9 +40,7 @@ export const api = async <T = unknown, Error = string>( status: number; data: ({ success: true } & T) | { success: false; error: Error }; }> => { const API_HOST = import.meta.env.VITE_API_HOST || ""; const req = await fetch(API_HOST + endpoint, { const req = await fetch(endpoint, { method, credentials: "include", headers: { Loading packages/client/vite.config.js +9 −0 Original line number Diff line number Diff line Loading @@ -23,4 +23,13 @@ export default defineConfig({ define: { __COMMIT_HASH__: JSON.stringify(commitHash), }, server: { proxy: { "/api": "http://localhost:3000", "/socket.io": { target: "ws://localhost:3000", ws: true, }, }, }, }); Loading
packages/client/src/lib/network.ts +5 −8 Original line number Diff line number Diff line Loading @@ -46,14 +46,11 @@ type SentEventValue<K extends keyof INetworkEvents> = EventEmitter.ArgumentMap< >[Extract<K, keyof INetworkEvents>]; class Network extends EventEmitter<INetworkEvents> { socket: Socket<ServerToClientEvents, ClientToServerEvents> = io( import.meta.env.VITE_API_HOST, { socket: Socket<ServerToClientEvents, ClientToServerEvents> = io("", { autoConnect: false, withCredentials: true, reconnection: true, } ); }); private online_count = 0; private stateEvents: { [key in keyof INetworkEvents]?: SentEventValue<key>; Loading
packages/client/src/lib/utils.ts +1 −3 Original line number Diff line number Diff line Loading @@ -40,9 +40,7 @@ export const api = async <T = unknown, Error = string>( status: number; data: ({ success: true } & T) | { success: false; error: Error }; }> => { const API_HOST = import.meta.env.VITE_API_HOST || ""; const req = await fetch(API_HOST + endpoint, { const req = await fetch(endpoint, { method, credentials: "include", headers: { Loading
packages/client/vite.config.js +9 −0 Original line number Diff line number Diff line Loading @@ -23,4 +23,13 @@ export default defineConfig({ define: { __COMMIT_HASH__: JSON.stringify(commitHash), }, server: { proxy: { "/api": "http://localhost:3000", "/socket.io": { target: "ws://localhost:3000", ws: true, }, }, }, });