Correct the code to work with the new data structure
This commit is contained in:
parent
6e51bf7656
commit
a36d85ae74
1 changed files with 4 additions and 2 deletions
|
|
@ -11,7 +11,9 @@ import { onMount } from "svelte";
|
||||||
|
|
||||||
function handleLobbyInfo(data: ILobbyInfo) {
|
function handleLobbyInfo(data: ILobbyInfo) {
|
||||||
if (data.status == Status.Success) {
|
if (data.status == Status.Success) {
|
||||||
players.set(data.players);
|
for (const player of data.players) {
|
||||||
|
$players[player.id] = player;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.table(data);
|
console.table(data);
|
||||||
};
|
};
|
||||||
|
|
@ -74,7 +76,7 @@ function toggleOption(e: CustomEvent<string>) {
|
||||||
<div class="sci-fi-box">
|
<div class="sci-fi-box">
|
||||||
<h2>Players</h2>
|
<h2>Players</h2>
|
||||||
<div class="player-box">
|
<div class="player-box">
|
||||||
{#each $players as p, i}
|
{#each Object.entries($players) as [id, p], i (id)}
|
||||||
<Player
|
<Player
|
||||||
name="{p.name}"
|
name="{p.name}"
|
||||||
colour="{p.colour}"
|
colour="{p.colour}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue