Skip to content

Commit

Permalink
fix: check patreon value
Browse files Browse the repository at this point in the history
  • Loading branch information
aalemayhu committed Oct 30, 2022
1 parent d09540c commit 1b57e12
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/routes/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,14 @@ router.get('/debug/locals', RequireAuthentication, (_req, res) => {
return res.json({ locals });
});

router.get('/is-patreon', (_req, res) => {
const { patreon } = res.locals;
return res.json({ patreon });
router.get('/is-patreon', async (_req, res) => {
const token = _req.cookies?.token;
if (token) {
const user = await TokenHandler.GetUserFrom(token);
let patreon = user?.patreon;
return res.json({ patreon });
}
return res.json({ patreon: false });
});

export default router;

0 comments on commit 1b57e12

Please sign in to comment.