aboutsummaryrefslogtreecommitdiffstats
path: root/backend/ts/api
diff options
context:
space:
mode:
Diffstat (limited to 'backend/ts/api')
-rw-r--r--backend/ts/api/getCurrentGameState.ts2
-rw-r--r--backend/ts/api/login.ts1
2 files changed, 2 insertions, 1 deletions
diff --git a/backend/ts/api/getCurrentGameState.ts b/backend/ts/api/getCurrentGameState.ts
index 896ccb4..4c87d18 100644
--- a/backend/ts/api/getCurrentGameState.ts
+++ b/backend/ts/api/getCurrentGameState.ts
@@ -12,7 +12,7 @@ export default async function getCurrentGameState(req: Request, res: Response) {
= (await makeQuery("SELECT `gameBoard`, `currentPlayer`, `started`, `data`, `timeTillTurnEnd`, `winner`"
+ " FROM `fia` WHERE `id` = ?",
[req.session.gid]))[0];
-
+
if (dbRes.started === 0) {
res.send(JSON.stringify({ data: dbRes.data }));
} else {
diff --git a/backend/ts/api/login.ts b/backend/ts/api/login.ts
index c01ef75..3b001ce 100644
--- a/backend/ts/api/login.ts
+++ b/backend/ts/api/login.ts
@@ -19,6 +19,7 @@ export default async function apiLogin(req: Request, res: Response) {
let dbRes = (await makeQuery("SELECT * FROM `fia` WHERE `started`= 0 LIMIT 1", [])) as Array<fiaTable>,
row: fiaTable;
+
if (dbRes[0] === undefined) {
let color = Helpers.getRandomInt(0, 4);
row = {} as fiaTable;