import { useParams } from 'common' import { Lock } from 'lucide-react' import { toast } from 'sonner' import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogTitle, } from 'ui' import { Admonition } from 'ui-patterns/Admonition' import { useOAuthAppDeleteMutation } from '@/data/oauth/oauth-app-delete-mutation' import type { OAuthApp } from '@/data/oauth/oauth-apps-query' export interface DeleteAppModalProps { selectedApp?: OAuthApp onClose: () => void } export const DeleteAppModal = ({ selectedApp, onClose }: DeleteAppModalProps) => { const { slug } = useParams() const { mutateAsync: deleteOAuthApp } = useOAuthAppDeleteMutation({ onSuccess: () => { toast.success(`Successfully deleted the app "${selectedApp?.name}"`) onClose() }, }) const onConfirmDelete = async () => { if (!slug) return console.error('Slug is required') if (!selectedApp?.id) return console.error('App ID is required') await deleteOAuthApp({ slug, id: selectedApp?.id }) } return ( {`Confirm to delete ${selectedApp?.name}`}
  • Before you remove this application, consider:
    • No users are currently using this application. It will no longer be available for use after deletion.
Cancel Confirm
) }