aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-09-17 16:26:13 +0200
committerMarvin Borner2020-09-17 16:26:13 +0200
commit1573ad3d3a21bfb9ac828949d4df0063bbeb40ca (patch)
treee3aabb08657120fbc7c28f46ebbed4689482ea2a
parent33ff64f9e1b680dc8c0af4c219f392ad5c72f4b2 (diff)
Why doesn't res.send return? :D
-rw-r--r--motto/index.js5
1 files changed, 4 insertions, 1 deletions
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) {