process user as object
This commit is contained in:
@@ -73,19 +73,18 @@ export default function Lobby() {
|
|||||||
getTrack();
|
getTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addUser(userName: string) {
|
function addUser(user: object) {
|
||||||
console.log(userList);
|
console.log(userList);
|
||||||
if (userList.find((user) => user.name == userName)) {
|
// if (userList.find((u) => u.name == user?.["username"])) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
const newUser = {
|
const newUser = {
|
||||||
id: userName,
|
id: user["id"],
|
||||||
name: userName,
|
name: user["username"],
|
||||||
avatar: `https://i.pravatar.cc/150?img=${userList.length + 1}`,
|
avatar: `https://i.pravatar.cc/150?img=${user["id"]}`,
|
||||||
host: userList.length === 0,
|
|
||||||
};
|
};
|
||||||
const newUserList = [...userList, newUser];
|
|
||||||
setUserList(newUserList);
|
setUserList([...userList, newUser]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTrack() {
|
async function getTrack() {
|
||||||
|
|||||||
Reference in New Issue
Block a user