[api] minor request validator to avoid spamming logs on invalid requests

This commit is contained in:
Andrea Vos 2023-05-25 22:34:30 +00:00
parent f85f62ced2
commit fa0a181117

View File

@ -563,6 +563,10 @@ router.post('/profile/save', handleErrorAsync(async (req, res) => {
}));
router.post('/profile/delete/:locale', handleErrorAsync(async (req, res) => {
if (!req.user) {
return res.status(400).json({error: 'Missing user'});
}
await req.db.get(SQL`DELETE FROM profiles WHERE userId = ${req.user.id} AND locale = ${req.params.locale}`);
return res.json(await fetchProfiles(req.db, req.user.username, true));