From f686dfe5fc0c885feb627d053c5cb6e61d44dc93 Mon Sep 17 00:00:00 2001 From: singharaj usai Date: Wed, 16 Oct 2024 12:46:39 -0400 Subject: [PATCH] granting currency fixed --- server/functions/api/routes/currency.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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' }); }