From ed715b14e4d5f7e0617cca6ed92835c024c9af56 Mon Sep 17 00:00:00 2001 From: Oliver Akins Date: Tue, 15 Mar 2022 23:25:56 -0600 Subject: [PATCH] Make it so that the game link gets added to the browser URL when joining a game --- web-svelte/src/components/modals/JoinLobby.svelte | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web-svelte/src/components/modals/JoinLobby.svelte b/web-svelte/src/components/modals/JoinLobby.svelte index 8b0250c..dc24ecd 100644 --- a/web-svelte/src/components/modals/JoinLobby.svelte +++ b/web-svelte/src/components/modals/JoinLobby.svelte @@ -16,6 +16,13 @@ let errorMessage: string|null = null; function handleLobbyConnection(data: ILobbyInfo) { if (data.status == Status.Success) { console.debug(`Succesfully joined lobby`); + + let url = new URL(window.location.href); + let qs = url.searchParams; + qs.set(`game`, data.game_code); + + window.history.replaceState(null, null, url) + gameCode.set(data.game_code); players.set(data.players); emit(`joined`);