remove references for the DB

This commit is contained in:
Oliver-Akins 2020-10-05 12:11:26 -06:00
parent dbd6aefbd2
commit b5f054f0b7

View file

@ -11,7 +11,6 @@ Client Side: After the host receives the `HostInformation` event, the Query
String parameters should be updated with the Websocket URI and the game code so
that the host is able to just send that to the other players
*/
import * as db from '../utils/db';
import { Socket } from 'socket.io';
import { Game } from '../utils/Game';
import { active_games, log } from '../main';
@ -22,7 +21,7 @@ export const HostGame = (socket: Socket, data: HostGame) => {
// Get a game code that is not in use to prevent join conflicts
let game_code = generate_game_code();
while (db.exists(game_code)) {
while (Object.keys(active_games).includes(game_code)) {
game_code = generate_game_code();
}
@ -35,8 +34,7 @@ export const HostGame = (socket: Socket, data: HostGame) => {
// Respond to client
socket.emit(`HostInformation`, {
success: true,
game_code: game_code,
players: [data.username]
game_code: game_code
});
} catch (err) {
log.error(err);