don't crash on missing user

This commit is contained in:
Barış Soner Uşaklı
2024-06-11 18:25:59 -04:00
parent 9ecee78293
commit 1ced3eb9f1

View File

@@ -14,8 +14,11 @@ followController.getFollowers = async function (req, res, next) {
await getFollow('account/followers', 'followers', req, res, next); await getFollow('account/followers', 'followers', req, res, next);
}; };
async function getFollow(tpl, name, req, res) { async function getFollow(tpl, name, req, res, next) {
const { userData: payload } = res.locals; const { userData: payload } = res.locals;
if (!payload) {
return next();
}
const { const {
username, userslug, followerCount, followingCount, username, userslug, followerCount, followingCount,
} = payload; } = payload;