Home / Function/ DeleteUserModal() — supabase Function Reference

DeleteUserModal() — supabase Function Reference

Architecture documentation for the DeleteUserModal() function in DeleteUserModal.tsx from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/studio/components/interfaces/Auth/Users/DeleteUserModal.tsx lines 15–59

export const DeleteUserModal = ({
  visible,
  selectedUser,
  onClose,
  onDeleteSuccess,
}: DeleteUserModalProps) => {
  const { ref: projectRef } = useParams()

  const { mutate: deleteUser, isPending: isDeleting } = useUserDeleteMutation({
    onSuccess: () => {
      toast.success(`Successfully deleted ${selectedUser?.email}`)
      onDeleteSuccess?.()
    },
  })

  const handleDeleteUser = async () => {
    if (!projectRef) return console.error('Project ref is required')
    if (selectedUser?.id === undefined) {
      return toast.error(`Failed to delete user: User ID not found`)
    }
    deleteUser({ projectRef, userId: selectedUser.id })
  }

  return (
    <ConfirmationModal
      visible={visible}
      variant="destructive"
      title="Confirm to delete user"
      loading={isDeleting}
      confirmLabel="Delete"
      onCancel={() => onClose()}
      onConfirm={() => handleDeleteUser()}
      alert={{
        title: 'Deleting a user is irreversible',
        description:
          'This will remove the selected the user from the project and all associated data.',
      }}
    >
      <p className="text-sm text-foreground-light">
        This is permanent! Are you sure you want to delete the user{' '}
        {selectedUser?.email ?? selectedUser?.phone ?? 'this user'}?
      </p>
    </ConfirmationModal>
  )
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free