const jwt = require('jsonwebtoken');
module.exports = (req, res, next) => {
try {
const token = req.headers.authorization;
const decoded = jwt.verify(token, 'somes');
req.user = decoded.user;
next();
} catch (error) {
return res.status(401).json({
message: 'Auth failed',
});
}
};
This is my check-auth middle ware I've configured AirBnB coding standards for this expressjs project.
I got an linting error. What does this really mean and how can I get rid of this error? Is it okay to put return statement in front of the next() function call like this return next(); How does that affect to the code?
error Expected to return a value at the end of arrow function consistent-return