diff --git a/server/functions/api/routes/currency.js b/server/functions/api/routes/currency.js index 0e0ed67..9edadc1 100644 --- a/server/functions/api/routes/currency.js +++ b/server/functions/api/routes/currency.js @@ -6,8 +6,7 @@ const moment = require('moment'); router.post('/claim-daily-currency', authenticateToken, async (req, res) => { try { - const userId = req.user.userId; - const user = await User.findById(userId); + const user = await User.findOne({ userId: req.user.userId }); if (!user) { return res.status(404).json({ error: 'User not found' }); }