Commit 6e90d3f0 authored by Matthieu - Greep's avatar Matthieu - Greep

Fix Missing vote if vote is 0

parent 532a5ce1
Pipeline #467 passed with stage
in 51 seconds
......@@ -10,11 +10,12 @@ const path = require('path'),
module.exports = function(app, sql, errorHandler) {
app.post('/'+scriptName, function(req, res) {
const mapId = req.query.map || req.body.map,
player = req.query.player || req.body.player,
vote = Number(req.query.vote || req.body.vote);
player = req.query.player || req.body.player;
let vote = req.query.vote || req.body.vote;
if (!mapId) return errorHandler(res, 400, 'Missing map id');
if (!player) return errorHandler(res, 400, 'Missing player login');
if (!vote) return errorHandler(res, 400, 'Missing vote');
vote = Number(vote);
if (isNaN(vote)) return errorHandler(res, 400, 'Invalid vote');
if (vote < 0 || vote > 100) return errorHandler(res, 400, 'Vote must be between 0 and 100');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment