refacto(#118): remove last toaster on start deployments

This commit is contained in:
Mauricio Siu
2024-06-06 00:11:46 -06:00
parent 0c197c095b
commit 7fb34ade00
7 changed files with 29 additions and 56 deletions

View File

@@ -11,6 +11,7 @@ import {
} from "@/components/ui/alert-dialog"; } from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { api } from "@/utils/api"; import { api } from "@/utils/api";
import { useEffect, useState } from "react";
import { toast } from "sonner"; import { toast } from "sonner";
interface Props { interface Props {
@@ -51,16 +52,12 @@ export const DeployApplication = ({ applicationId }: Props) => {
applicationId, applicationId,
}) })
.then(async () => { .then(async () => {
toast.success("Application Deploying...."); toast.success("Deploying Application....");
await refetch(); await refetch();
await deploy({ await deploy({
applicationId, applicationId,
}) }).catch(() => {
.then(() => {
toast.success("Application Deployed Succesfully");
})
.catch(() => {
toast.error("Error to deploy Application"); toast.error("Error to deploy Application");
}); });

View File

@@ -49,16 +49,12 @@ export const DeployCompose = ({ composeId }: Props) => {
composeStatus: "running", composeStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Compose Deploying...."); toast.success("Deploying Compose....");
await refetch(); await refetch();
await deploy({ await deploy({
composeId, composeId,
}) }).catch(() => {
.then(() => {
toast.success("Compose Deployed Succesfully");
})
.catch(() => {
toast.error("Error to deploy Compose"); toast.error("Error to deploy Compose");
}); });

View File

@@ -50,15 +50,11 @@ export const DeployMariadb = ({ mariadbId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
mariadbId, mariadbId,
}) }).catch(() => {
.then(() => {
toast.success("Database Deployed Succesfully");
})
.catch(() => {
toast.error("Error to deploy Database"); toast.error("Error to deploy Database");
}); });
await refetch(); await refetch();

View File

@@ -50,15 +50,11 @@ export const DeployMongo = ({ mongoId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
mongoId, mongoId,
}) }).catch(() => {
.then(() => {
toast.success("Database Deployed Succesfully");
})
.catch(() => {
toast.error("Error to deploy Database"); toast.error("Error to deploy Database");
}); });
await refetch(); await refetch();

View File

@@ -50,15 +50,11 @@ export const DeployMysql = ({ mysqlId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
mysqlId, mysqlId,
}) }).catch(() => {
.then(() => {
toast.success("Database Deployed Succesfully");
})
.catch(() => {
toast.error("Error to deploy Database"); toast.error("Error to deploy Database");
}); });
await refetch(); await refetch();

View File

@@ -50,15 +50,11 @@ export const DeployPostgres = ({ postgresId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database....");
await refetch(); await refetch();
await deploy({ await deploy({
postgresId, postgresId,
}) }).catch(() => {
.then(() => {
toast.success("Database Deployed Succesfully");
})
.catch(() => {
toast.error("Error to deploy Database"); toast.error("Error to deploy Database");
}); });
await refetch(); await refetch();

View File

@@ -50,15 +50,11 @@ export const DeployRedis = ({ redisId }: Props) => {
applicationStatus: "running", applicationStatus: "running",
}) })
.then(async () => { .then(async () => {
toast.success("Database Deploying...."); toast.success("Deploying Database...");
await refetch(); await refetch();
await deploy({ await deploy({
redisId, redisId,
}) }).catch(() => {
.then(() => {
toast.success("Database Deployed Succesfully");
})
.catch(() => {
toast.error("Error to deploy Database"); toast.error("Error to deploy Database");
}); });
await refetch(); await refetch();