aboutsummaryrefslogtreecommitdiffstats
path: root/backend/ts/api/getCurrentGameState.ts
diff options
context:
space:
mode:
authorMaks Jopek <maksymilian.jopek@prym-soft.pl>2021-04-29 20:05:06 +0200
committerMaks Jopek <maksymilian.jopek@prym-soft.pl>2021-04-29 20:05:06 +0200
commit040d5372c1033bb7c0580ad2c9b6b32f974a20c8 (patch)
treee452aa8ad583607b87d47ef82eabf0bd7e3ab60a /backend/ts/api/getCurrentGameState.ts
parent6baaa14bde032afa363dbdd50119a20e9f47df1c (diff)
downloadfia-040d5372c1033bb7c0580ad2c9b6b32f974a20c8.tar.gz
fia-040d5372c1033bb7c0580ad2c9b6b32f974a20c8.tar.zst
fia-040d5372c1033bb7c0580ad2c9b6b32f974a20c8.zip
Version 1.0
Diffstat (limited to 'backend/ts/api/getCurrentGameState.ts')
-rw-r--r--backend/ts/api/getCurrentGameState.ts8
1 files changed, 2 insertions, 6 deletions
diff --git a/backend/ts/api/getCurrentGameState.ts b/backend/ts/api/getCurrentGameState.ts
index 028cf04..28522e1 100644
--- a/backend/ts/api/getCurrentGameState.ts
+++ b/backend/ts/api/getCurrentGameState.ts
@@ -1,8 +1,7 @@
import { Request, Response } from "express";
-import { Data, makeQuery, getData, API_RES, GameBoard } from "../../../helpers/helpersBack";
+import { Data, makeQuery, API_RES, GameBoard } from "../../../helpers/helpersBack";
export default async function getCurrentGameState(req: Request, res: Response) {
- // console.log("request.session", req.session)
if (req.session === undefined || req.session.gid === undefined) {
res.status(400);
res.send(API_RES.failure);
@@ -13,13 +12,10 @@ export default async function getCurrentGameState(req: Request, res: Response) {
= (await makeQuery("SELECT `gameBoard`, `currentPlayer`, `started`, `data`, `timeTillTurnEnd`"
+ " FROM `fia` WHERE `id` = ?",
[req.session.gid]))[0];
-
if (dbRes.started === 0) {
res.send(JSON.stringify({ data: dbRes.data }));
} else {
res.send(JSON.stringify(dbRes));
}
-
-
-} \ No newline at end of file
+}