diff --git a/helpers/authenticate.js b/helpers/authenticate.js index 194aef5..9f474b2 100644 --- a/helpers/authenticate.js +++ b/helpers/authenticate.js @@ -8,17 +8,17 @@ const authenticate = (req, res, next) => { const token = authHeader.split(" ")[1]; JWT.verify(token, process.env.SECRET_KEY, (err, decoded) => { if (err) { - res.status(403).json("You're not authorized."); + return res.status(403).json("You're not authorized."); } else { console.log(decoded); next(); } }); } else { - res.status(403).json("The token is invalid."); + return res.status(403).json("The token is invalid."); } } else { - res.status(403).json("You're not authorized."); + return res.status(403).json("You're not authorized."); } };