Add code to handle the lobby info responses
This commit is contained in:
parent
2c4c7c38b0
commit
1b9f3d780e
1 changed files with 8 additions and 3 deletions
|
|
@ -3,14 +3,19 @@ import ShipDesigner from "../../components/modals/ShipDesigner.svelte";
|
|||
import OptionInfo from "../../components/modals/OptionInfo.svelte";
|
||||
import SciFiCheckbox from "../../components/SciFi-Checkbox.svelte";
|
||||
import SciFiButton from "../../components/SciFi-Button.svelte";
|
||||
import { ILobbyInfo, Status, gameOptions } from "common";
|
||||
import Player from "../../components/Player.svelte";
|
||||
import { isHost, players } from "../../stores";
|
||||
import { onMount, onDestroy } from "svelte"
|
||||
import type { ILobbyInfo } from "common";
|
||||
import { gameOptions } from "common";
|
||||
import { socket } from "../../main";
|
||||
|
||||
function handleLobbyInfo(data: ILobbyInfo) {};
|
||||
function handleLobbyInfo(data: ILobbyInfo) {
|
||||
if (data.status == Status.Success) {
|
||||
players.set(data.players);
|
||||
} else {
|
||||
console.table(data);
|
||||
};
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
socket.on(`res:lobby.info`, handleLobbyInfo);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue