Replace deleteAccount with deleteUser in admin dialog

The code updates the action called when submitting the form in the 'AdminDeleteUserDialog' component. Instead of triggering 'deleteAccount', it now calls 'deleteUser'. Additionally, after a user or an account is deleted, the admin is redirected to the '/admin/accounts' route instead of receiving a 'success: true' message.
This commit is contained in:
giancarlo
2024-04-09 15:54:15 +08:00
parent e8d2a28738
commit 1a3c27326b
2 changed files with 5 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
'use server';
import { revalidatePath } from 'next/cache';
import { redirect } from 'next/navigation';
import { enhanceAction } from '@kit/next/actions';
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
@@ -92,9 +93,7 @@ export const deleteUser = enhanceAdminAction(
revalidateAdmin();
return {
success: true,
};
return redirect('/admin/accounts');
},
{
schema: DeleteUserSchema,
@@ -115,9 +114,7 @@ export const deleteAccount = enhanceAdminAction(
revalidateAdmin();
return {
success: true,
};
return redirect('/admin/accounts');
},
{
schema: DeleteAccountSchema,