fix: resolve infinite loading on user deletion by adding try-finally and deleting from public.users first
All checks were successful
Staging Build / build (push) Successful in 2m35s

This commit is contained in:
DanielS
2026-06-25 01:25:49 +02:00
parent 03d711c2e1
commit 396f135e87
2 changed files with 12 additions and 3 deletions

View File

@@ -91,6 +91,9 @@ export async function createUser(data: { email: string; role?: 'admin' | 'partne
export async function deleteUser(id: string) {
const admin = createAdminClient();
// Delete from public.users first to satisfy foreign key constraints
await admin.from('users').delete().eq('id', id);
const { error } = await admin.auth.admin.deleteUser(id);
if (error) throw error;
revalidatePath('/admin/users');