bug fix + use id instead of username for lookup

This commit is contained in:
Daniel
2023-07-19 12:14:52 -04:00
parent 01a8579158
commit 35bece5f49
13 changed files with 24 additions and 29 deletions
+3 -3
View File
@@ -8,10 +8,10 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
const session = await getServerSession(req, res, authOptions);
const userId = session?.user.id;
const userName = session?.user.username?.toLowerCase();
const username = session?.user.username?.toLowerCase();
const queryId = Number(req.query.id);
if (!userId || !userName)
if (!userId || !username)
return res
.setHeader("Content-Type", "text/plain")
.status(401)
@@ -37,7 +37,7 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
if (
targetUser?.isPrivate &&
!targetUser.whitelistedUsers.includes(userName)
!targetUser.whitelistedUsers.includes(username)
) {
return res
.setHeader("Content-Type", "text/plain")