diff options
| author | Maks Jopek <maksymilian.jopek@prym-soft.pl> | 2021-04-10 01:06:09 +0200 |
|---|---|---|
| committer | Maks Jopek <maksymilian.jopek@prym-soft.pl> | 2021-04-10 01:06:09 +0200 |
| commit | dd66b8ad239d5ceae219746a702963645259b784 (patch) | |
| tree | 47462463911a018a31cd1ede3d8206fd96032b99 /backend/ts/api/startPoint.ts | |
| parent | d928eab3ecefbf778f1cadece9beac010dc42332 (diff) | |
| download | fia-dd66b8ad239d5ceae219746a702963645259b784.tar.gz fia-dd66b8ad239d5ceae219746a702963645259b784.tar.zst fia-dd66b8ad239d5ceae219746a702963645259b784.zip | |
Added joining rooms and logic to start game by votes
Diffstat (limited to 'backend/ts/api/startPoint.ts')
| -rw-r--r-- | backend/ts/api/startPoint.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/backend/ts/api/startPoint.ts b/backend/ts/api/startPoint.ts new file mode 100644 index 0000000..0fa79e5 --- /dev/null +++ b/backend/ts/api/startPoint.ts @@ -0,0 +1,20 @@ +import { Request, Response } from "express"; +import { makeQuery } from "../../../helpers/helpers"; + +export default async function (req: Request, res: Response) { + if (req.session === undefined) { + res.send(/* html */ `<script>alert("Something went wrong, try to reload the page")</script>`); + return; + } + console.log("uid:", req.session.uid, "gid:", req.session.gid); + if (req.session.uid !== undefined) { + let data = await makeQuery('SELECT `data` FROM `fia` WHERE `id`=?', [req.session.gid]); + console.log("data: ", data); + res.send(JSON.stringify({ + status: true, + data: data + })) + } + else + res.send(JSON.stringify({ status: false })); +}
\ No newline at end of file |
