import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import { api } from "@/utils/api"; import { RefreshCcw } from "lucide-react"; import { toast } from "sonner"; interface Props { postgresId: string; appName: string; } export const ResetPostgres = ({ postgresId, appName }: Props) => { const { refetch } = api.postgres.one.useQuery( { postgresId, }, { enabled: !!postgresId }, ); const { mutateAsync: reload, isLoading } = api.postgres.reload.useMutation(); return ( Are you absolutely sure? This will reload the service Cancel { await reload({ postgresId, appName, }) .then(() => { toast.success("Service Reloaded"); }) .catch(() => { toast.error("Error to reload the service"); }); await refetch(); }} > Confirm ); };