import { useState } from 'react' import { toast } from 'sonner' import { deleteSysRole } from '@/api' import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog' import { Button } from '@/components/ui/button.tsx' import { Spinner } from '@/components/ui/spinner.tsx' import { type SysRole } from '@/schemas' interface Props { currentRow: SysRole onClose: () => void onConfirm: () => void open: boolean } export function DeleteDialog({ open, onClose, currentRow, onConfirm }: Props) { const [loading, setLoading] = useState(false) const onDelete = async () => { try { setLoading(true) await deleteSysRole(currentRow.id) toast('操作成功!') onConfirm() } finally { setLoading(false) } } return ( 删除角色? 确认删除【{currentRow?.name}】吗? 取消 ) }