Make it so that the game link gets added to the browser URL when joining a game

This commit is contained in:
Oliver Akins 2022-03-15 23:25:56 -06:00
parent 7d39b41b6d
commit ed715b14e4
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99

View file

@ -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`);