diff --git a/server/src/database/api.ts b/server/src/database/api.ts index dfe6965..50b635f 100755 --- a/server/src/database/api.ts +++ b/server/src/database/api.ts @@ -17,15 +17,15 @@ export async function registerUser(email: string, name: string, group: Group) { return; } -export async function getUserTeam(email: string): Promise { +export async function getUserTeam(email: string): Promise { if (connection == null) { - return null; + return undefined; } const query = `select team from users where email=$1` const values = [email]; const res = await connection.query(query, values); if (res.rows.length == 0) { - return null; + return undefined; } else { return res.rows[0].team; } diff --git a/server/src/index.ts b/server/src/index.ts index 7505f15..c884feb 100755 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -152,7 +152,7 @@ io.on("connection", (socket) => { // socket.data.group = 2; // } socket.data.group = await getUserTeam(unique_name); - if (socket.data.group == null) { + if (!socket.data.group) { socket.data.group = Math.random() > 0.5 ? 2 : 1; } } else {