This commit is contained in:
Lukian 2024-09-16 18:05:04 +02:00
parent 49cef6f533
commit 54aeaa5bb3
3 changed files with 4 additions and 5 deletions

View file

@ -27,7 +27,6 @@ router.post('/', async (req, res) => {
} }
const connection = await getConnection(); const connection = await getConnection();
const user = await getUser(connection, username); const user = await getUser(connection, username);
if (!user[0]) { if (!user[0]) {
@ -38,7 +37,7 @@ router.post('/', async (req, res) => {
return res.status(400).send({error: "user already verified"}); return res.status(400).send({error: "user already verified"});
} }
await setVerified(username); await setVerified(connection, username);
connection.end() connection.end()
res.status(200).send({message: "user verified"}); res.status(200).send({message: "user verified"});
}); });

View file

@ -27,7 +27,7 @@ router.post('/', async (req, res) => {
} }
const connection = await getConnection(); const connection = await getConnection();
const helpers = await getHelpers(gameid) const helpers = await getHelpers(connection, gameid)
connection.end(); connection.end();
if (!helpers[0]) { if (!helpers[0]) {

View file

@ -24,7 +24,7 @@ router.post('/', async (req, res) => {
} }
const connection = await getConnection(); const connection = await getConnection();
const game = await getGame(gameid); const game = await getGame(connection, gameid);
if (!game[0]) { if (!game[0]) {
return res.status(400).send({error: "this game doesn't exist"}); return res.status(400).send({error: "this game doesn't exist"});
@ -34,7 +34,7 @@ router.post('/', async (req, res) => {
return res.status(400).send({error: "you are not an helper for this game"}); return res.status(400).send({error: "you are not an helper for this game"});
} }
await removeHelper(user.user.username, gameid); await removeHelper(connection, user.user.username, gameid);
connection.end() connection.end()
} catch { } catch {
return res.status(400).send({error: "invalid token"}); return res.status(400).send({error: "invalid token"});