Fixed a bug in the authentication middleware

This commit is contained in:
2022-12-28 15:03:04 +01:00
parent 6c85ff5bcc
commit dc7a095f73

View File

@ -10,6 +10,7 @@ module.exports = async (req, res, next) => {
if (user === null) return res.status(401).json({message: "The provided token is incorrect"});
req.user = await getUserById(user.userId);
if (req.user === null) return res.status(401).json({message: "The provided token is incorrect"});
next();
}