fix id
This commit is contained in:
@@ -2,7 +2,6 @@ import User from '../../models/User';
|
||||
import { connectDB } from '../../lib/utils';
|
||||
|
||||
export default async (req, res) => {
|
||||
await connectDB();
|
||||
const { userId } = req.query;
|
||||
|
||||
console.log('Received request with userId:', userId);
|
||||
@@ -12,10 +11,12 @@ export default async (req, res) => {
|
||||
return res.status(401).json({ message: 'Unauthorized' });
|
||||
}
|
||||
|
||||
const user = await User.findOne({ clerkId: userId });
|
||||
await connectDB();
|
||||
|
||||
const user = await User.findOne({ id: userId });
|
||||
|
||||
if (!user) {
|
||||
console.log('User not found for clerkId:', userId);
|
||||
console.log('User not found for userId:', userId);
|
||||
return res.status(404).json({ message: 'User not found' });
|
||||
}
|
||||
|
||||
@@ -34,3 +35,4 @@ export default async (req, res) => {
|
||||
res.status(405).json({ message: 'Method not allowed' });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user