From 2e7b3f1fde8f63fb57be1151a06c35c086dcd4d8 Mon Sep 17 00:00:00 2001 From: ilbertt Date: Thu, 6 Jun 2024 18:48:29 +0200 Subject: [PATCH] fix: frontend error logic --- frontend/app/dashboard/new-deployment/page.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/app/dashboard/new-deployment/page.tsx b/frontend/app/dashboard/new-deployment/page.tsx index 1e38312..930851a 100644 --- a/frontend/app/dashboard/new-deployment/page.tsx +++ b/frontend/app/dashboard/new-deployment/page.tsx @@ -73,7 +73,6 @@ export default function NewDeployment() { setDeploymentSteps([]); setDeploymentError(null); - setIsDeploying(false); setIsSubmitting(true); setPaymentStatus(null); @@ -94,6 +93,7 @@ export default function NewDeployment() { setPaymentStatus(prev => prev + " FAILED"); setDeploymentParams(null); setIsSubmitting(false); + setIsDeploying(false); return; } }, [backendActor, deploymentE8sPrice, ledgerCanister, refreshLedgerData, toastError]); @@ -121,10 +121,6 @@ export default function NewDeployment() { try { await createDeployment(); } catch (e: any) { - console.error("Failed to create deployment:", e); - - setIsDeploying(false); - if (e.message.startsWith("Not enough balance. Required: ")) { console.warn("Failed to create deployment, insufficient balance. Auto top-up initiated."); @@ -133,6 +129,8 @@ export default function NewDeployment() { await createDeployment(); } else { + console.error("Failed to create deployment:", e); + setIsDeploying(false); setDeploymentError("Failed to create deployment, see console for details"); } }