Updated the validateSchema util

This commit is contained in:
2023-01-08 03:25:12 +01:00
parent cb441df58b
commit e6b11fee5f
5 changed files with 13 additions and 13 deletions

View File

@ -7,7 +7,7 @@ const {authUser} = require("../controller/user");
app.post("/login", async (req, res) => {
const error = await validateSchema(authValidation, req.body);
if (error) return res.status(400).json({message: error});
if (error) return res.status(400).json(error);
let user = await authUser(req.body.username, req.body.password);
if (!user) return res.status(401).json({message: "Please use the correct username / password combination"});
@ -19,4 +19,4 @@ app.post("/login", async (req, res) => {
res.json({message: "Successfully logged in"});
});
module.exports = app;
module.exports = app;