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 { useRouter } from "next/router"; import { toast } from "sonner"; interface Props { composeId: string; } export const DeployCompose = ({ composeId }: Props) => { const router = useRouter(); const { data, refetch } = api.compose.one.useQuery( { composeId, }, { enabled: !!composeId }, ); const { mutateAsync: deploy } = api.compose.deploy.useMutation(); return ( Are you absolutely sure? This will deploy the compose Cancel { toast.success("Deploying Compose...."); await refetch(); await deploy({ composeId, }) .then(async () => { router.push( `/dashboard/project/${data?.project.projectId}/services/compose/${composeId}?tab=deployments`, ); }) .catch(() => { toast.error("Error deploying Compose"); }); await refetch(); }} > Confirm ); };