fix: token

This commit is contained in:
2025-10-01 10:18:44 +07:00
parent 1cadf8c69d
commit 909c6d5fba

View File

@@ -8,7 +8,8 @@ function setUser(req, decoded) {
username: decoded.user_name, username: decoded.user_name,
email: decoded.user_email, email: decoded.user_email,
roleId: decoded.role_id, roleId: decoded.role_id,
roleName: decoded.role_name roleName: decoded.role_name,
is_sa: decoded.is_sa
}; };
} }
@@ -44,10 +45,10 @@ function verifyRefreshToken(req, res, next) {
} }
const decoded = JWTService.verifyRefreshToken(refreshToken); const decoded = JWTService.verifyRefreshToken(refreshToken);
setUser(req, decoded); req.user = decoded;
next(); next();
} catch (error) { } catch (error) {
next(new ErrorHandler(500, 'Refresh token verification failed')); next(new ErrorHandler(401, 'Refresh token is invalid or expired'));
} }
} }