This commit is contained in:
payacom
2026-07-10 17:53:53 +03:30
parent 51eb7d0224
commit 3c90976f23

View File

@@ -945,7 +945,14 @@ const getUsers = async (req, res, next) => {
const getPostsWeb = async (req, res, next) => {
try {
const token = req.header("Authorization")?.split(" ")[1];
const decodedToken = token ? jwt.verify(token, process.env.APP_SECRET) : null;
let decodedToken = null;
if (token) {
try {
decodedToken = jwt.verify(token, process.env.APP_SECRET);
} catch (err) {
console.warn("توکن نامعتبر است، ادامه بدون احراز هویت");
}
}
const {
expertise,