Fixed a problem with the update of a user
This commit is contained in:
@@ -79,6 +79,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
let user = await db.collection("users").findOne<User>({id: queryId ? (queryId as string) : req.session.user.id});
|
||||
const updatedUser = req.body as User & {password?: string; newPassword?: string};
|
||||
delete (updatedUser as any)._id
|
||||
|
||||
if (!!queryId) {
|
||||
await db.collection("users").updateOne({id: queryId}, {$set: updatedUser});
|
||||
|
||||
Reference in New Issue
Block a user