Skip to content

Commit

Permalink
chore: add return statements to auth
Browse files Browse the repository at this point in the history
  • Loading branch information
FREDVUNI committed Oct 29, 2023
1 parent 5875174 commit bdefbee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions helpers/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
};

Expand Down

0 comments on commit bdefbee

Please sign in to comment.