import { useParams } from 'common' import { Lock } from 'lucide-react' import { toast } from 'sonner' import { Modal } from 'ui' import { Admonition } from 'ui-patterns' 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 { mutate: deleteOAuthApp, isPending: isDeleting } = 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') deleteOAuthApp({ slug, id: selectedApp?.id }) } return ( ) }