提交供应商以及删除无关代码
This commit is contained in:
@@ -10,7 +10,6 @@ const JWT_SECRET = process.env.JWT_SECRET || 'your-secret-key'; // 在生产环
|
||||
const auth = async (req, res, next) => {
|
||||
try {
|
||||
const token = req.header('Authorization')?.replace('Bearer ', '');
|
||||
|
||||
if (!token) {
|
||||
return res.status(401).json({ success: false, message: '未提供认证令牌' });
|
||||
}
|
||||
@@ -48,6 +47,7 @@ const auth = async (req, res, next) => {
|
||||
req.user = user;
|
||||
next();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(401).json({ success: false, message: '无效的认证令牌' });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user