From 698c41544c25a7b86f62c88fa832fd8aa84e6d07 Mon Sep 17 00:00:00 2001 From: Mark Hoekveen Date: Sat, 16 Aug 2025 23:30:49 +0200 Subject: [PATCH] process user as object --- frontend/src/app/lobby/page.tsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/lobby/page.tsx b/frontend/src/app/lobby/page.tsx index 74fd342..821de6d 100644 --- a/frontend/src/app/lobby/page.tsx +++ b/frontend/src/app/lobby/page.tsx @@ -73,19 +73,18 @@ export default function Lobby() { getTrack(); } - function addUser(userName: string) { + function addUser(user: object) { console.log(userList); - if (userList.find((user) => user.name == userName)) { - return; - } + // if (userList.find((u) => u.name == user?.["username"])) { + // return; + // } const newUser = { - id: userName, - name: userName, - avatar: `https://i.pravatar.cc/150?img=${userList.length + 1}`, - host: userList.length === 0, + id: user["id"], + name: user["username"], + avatar: `https://i.pravatar.cc/150?img=${user["id"]}`, }; - const newUserList = [...userList, newUser]; - setUserList(newUserList); + + setUserList([...userList, newUser]); } async function getTrack() {