diff --git a/client/svelte-client/src/api/session.ts b/client/svelte-client/src/api/session.ts index 0ac7eee..226cb82 100644 --- a/client/svelte-client/src/api/session.ts +++ b/client/svelte-client/src/api/session.ts @@ -24,19 +24,14 @@ async function createNetworkSession(): Promise { }); } -const joinSessionPath = "/pong/api/join_session" - -function createJoinLink(sessionId: string, relative = false): string { - let link = `${joinSessionPath}?session_id=${sessionId}`; - if (!relative) { - link = window.location.origin + link; - } - return link; +function createJoinLink(sessionId: string): string { + return `${window.location.origin}${window.location.pathname}?session_id=${sessionId}`; } async function joinNetworkSession(sessionId): Promise { - return fetch(createJoinLink(sessionId, true), { + return fetch("/pong/api/join_session", { method: 'POST', + body: JSON.stringify({session_id: sessionId}), headers: [['Content-Type', 'application/json']] }) .then(sessionResponseHandler) diff --git a/client/svelte-client/src/components/ModeSelect.svelte b/client/svelte-client/src/components/ModeSelect.svelte index cc545f4..b733709 100644 --- a/client/svelte-client/src/components/ModeSelect.svelte +++ b/client/svelte-client/src/components/ModeSelect.svelte @@ -1,6 +1,7 @@