From 1573ad3d3a21bfb9ac828949d4df0063bbeb40ca Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 17 Sep 2020 16:26:13 +0200 Subject: Why doesn't res.send return? :D --- motto/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'motto/index.js') diff --git a/motto/index.js b/motto/index.js index 04f4527..429e367 100644 --- a/motto/index.js +++ b/motto/index.js @@ -70,7 +70,10 @@ app.post("/api/add", (req, res) => { app.post("/api/vote", (req, res) => { console.log(req.body.id, req.body.vote); - if (req.body.vote < -1 || req.body.vote > 1) res.send("error"); + if (req.body.vote < -1 || req.body.vote > 1) { + res.send("error"); + return; + } db.all("UPDATE theme SET votes = votes + ? WHERE id = ?", [req.body.vote, req.body.id], (err) => { if (err) { -- cgit v1.2.3