made the loby working using the newer rDB and makeing everything to bbe better manageable by using folders and more components!
This commit is contained in:
parent
2b9b5c3b39
commit
d3e0f3406e
37 changed files with 417 additions and 159 deletions
18
src/routes/play/[gamePin]/logic/GetCurrentPlayers.js
Normal file
18
src/routes/play/[gamePin]/logic/GetCurrentPlayers.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { supabase } from "$lib/supabase.js";
|
||||
import { players } from "./HostsData.svelte.js";
|
||||
|
||||
export async function GetCurrentPlayers(gamePin) {
|
||||
const { data, error } = await supabase
|
||||
.from("players")
|
||||
.select("playername")
|
||||
.eq("gameid", Number(gamePin));
|
||||
|
||||
console.log("Current players data:", JSON.stringify(data));
|
||||
|
||||
if (error) {
|
||||
console.error("Error fetching players:", error);
|
||||
return;
|
||||
}
|
||||
|
||||
players.v = data ? data.map(player => player.playername) : [];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue