mirror of
https://github.com/better-auth/better-auth.git
synced 2026-08-02 11:03:49 -05:00
fix: call db hooks when calling deleteUser (#5553)
This commit is contained in:
@@ -526,7 +526,6 @@ export const deleteUser = createAuthEndpoint(
|
||||
}
|
||||
await ctx.context.internalAdapter.deleteUser(session.user.id);
|
||||
await ctx.context.internalAdapter.deleteSessions(session.user.id);
|
||||
await ctx.context.internalAdapter.deleteAccounts(session.user.id);
|
||||
deleteSessionCookie(ctx);
|
||||
const afterDelete = ctx.context.options.user.deleteUser?.afterDelete;
|
||||
if (afterDelete) {
|
||||
|
||||
@@ -236,16 +236,17 @@ export const createInternalAdapter = (
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
|
||||
await (await getCurrentAdapter(adapter)).deleteMany({
|
||||
model: "account",
|
||||
where: [
|
||||
await deleteManyWithHooks(
|
||||
[
|
||||
{
|
||||
field: "userId",
|
||||
value: userId,
|
||||
},
|
||||
],
|
||||
});
|
||||
"account",
|
||||
undefined,
|
||||
);
|
||||
|
||||
await deleteWithHooks(
|
||||
[
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user