Validation too strict, removed typeof checks

This commit is contained in:
Andrew Scott 2022-06-04 03:23:10 -04:00
parent 552187d53e
commit caf5bdab80
Signed by: a
GPG key ID: 3EB62D0BBB8DB381

View file

@ -96,9 +96,9 @@ app.put(
let resultVal; let resultVal;
if (req.body.name === "" || typeof req.body.name !== "string") { if (req.body.name === "" || typeof req.body.name !== "string") {
isValid = false; isValid = false;
} else if (typeof req.body.reps !== "number" || req.body.reps < 1) { } else if (req.body.reps < 1) {
isValid = false; isValid = false;
} else if (typeof req.body.weight !== "number" || req.body.weight < 1) { } else if (req.body.weight < 1) {
isValid = false; isValid = false;
} else if (req.body.unit !== "lbs" && req.body.unit !== "kgs") { } else if (req.body.unit !== "lbs" && req.body.unit !== "kgs") {
isValid = false; isValid = false;