Skip to content

Commit

Permalink
api validation check
Browse files Browse the repository at this point in the history
  • Loading branch information
k2xl committed Jun 19, 2024
1 parent 3dc8b0d commit 98ee875
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pages/api/report/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import DiscordChannel from '@root/constants/discordChannel';
import { GameId } from '@root/constants/GameId';
import queueDiscordWebhook from '@root/helpers/discordWebhook';
import { getGameFromId } from '@root/helpers/getGameIdFromReq';
import isGuest from '@root/helpers/isGuest';
import { logger } from '@root/helpers/logger';
import Comment from '@root/models/db/comment';
import Level from '@root/models/db/level';
Expand All @@ -24,6 +25,10 @@ export default withAuth({
},
},
}, async (req: NextApiRequestWithAuth, res: NextApiResponse) => {
if (isGuest(req.user)) {
return res.status(401).json({ error: 'Guest users are not able to report content.' });
}

const { targetId, reportReason, reportType, message } = req.body;

let url = '';
Expand Down

0 comments on commit 98ee875

Please sign in to comment.