Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const deleteCurrentUserHandler = async function(request, h) {
try {
const _id = request.auth.credentials.user._id
return await RestHapi.deleteOne(User, _id, {}, Log)
} catch (err) {
errorHelper.handleError(err, Log)
}
}
const deleteCurrentUserHandler = function (request, reply) {
const _id = request.auth.credentials.user._id;
return RestHapi.deleteOne(User, _id, {}, Log)
.then(function (user) {
return reply(user);
})
.catch(function (error) {
Log.error(error);
return reply(RestHapi.errorHelper.formatResponse(error));
});
};
const deleteCurrentUserHandler = function (request, reply) {
const _id = request.auth.credentials.user._id;
return RestHapi.deleteOne(User, _id, {}, Log)
.then(function (user) {
return reply(user);
})
.catch(function (error) {
Log.error(error);
return reply(RestHapi.errorHelper.formatResponse(error));
});
};