process user as object
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user