Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const currentUser = await SecurityUser.findById(user.id);
if (currentUser) {
try {
currentUser.populate(args.data);
await currentUser.save();
return new Response(currentUser);
} catch (e) {
return new ErrorResponse({
code: e.code,
message: e.message,
data: e.data || null
});
}
}
return new NotFoundResponse("User not found!");
};