Updated the validateSchema util
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user