Make it so that the game link gets added to the browser URL when joining a game
This commit is contained in:
parent
7d39b41b6d
commit
ed715b14e4
1 changed files with 7 additions and 0 deletions
|
|
@ -16,6 +16,13 @@ let errorMessage: string|null = null;
|
||||||
function handleLobbyConnection(data: ILobbyInfo) {
|
function handleLobbyConnection(data: ILobbyInfo) {
|
||||||
if (data.status == Status.Success) {
|
if (data.status == Status.Success) {
|
||||||
console.debug(`Succesfully joined lobby`);
|
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);
|
gameCode.set(data.game_code);
|
||||||
players.set(data.players);
|
players.set(data.players);
|
||||||
emit(`joined`);
|
emit(`joined`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue