process user as object

This commit is contained in:
2025-08-16 23:30:49 +02:00
parent 5de174b162
commit 698c41544c
+9 -10
View File
@@ -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() {