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
All checks were successful
Staging Build / build (push) Successful in 2m35s
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user