add userid sending

This commit is contained in:
Joseph J Helfenbein
2025-01-25 06:32:26 -05:00
parent f5735d85e3
commit fe228f211f
2 changed files with 29 additions and 29 deletions

View File

@@ -1,16 +1,15 @@
import { getAuth } from '@clerk/nextjs/server';
import User from '../../models/User';
import { connectDB } from '../../lib/utils';
export default async (req, res) => {
await connectDB();
const { userId } = getAuth(req);
const { userId } = req.query;
if (!userId) {
return res.status(401).json({ message: 'Unauthorized' });
}
const user = await User.findOne({ id: userId });
const user = await User.findOne({ clerkId: userId });
if (!user) {
return res.status(404).json({ message: 'User not found' });