♻️ show warning toast and do not throw error in case of UI source

This commit is contained in:
Fred KISSIE
2025-10-30 02:18:48 +01:00
parent 3d376c8d14
commit 49dffe086d
3 changed files with 8 additions and 5 deletions

View File

@@ -166,7 +166,8 @@ export async function applyBlueprint({
blueprint = newBlueprint[0];
});
if (!blueprint || !blueprintSucceeded) {
if (!blueprint || (source !== "UI" && !blueprintSucceeded)) {
// ^^^^^^^^^^^^^^^ The UI considers a failed blueprint as a valid response
throw error ?? "Unknown Server Error";
}

View File

@@ -107,10 +107,11 @@ export default function CreateBlueprintForm({
});
if (res && res.status === 201) {
const createdBlueprint = res.data.data;
toast({
variant: "default",
title: "Success",
description: res.data.data.message
variant: "warning",
title: createdBlueprint.succeeded ? "Success" : "Warning",
description: createdBlueprint.message
});
router.push(`/${orgId}/settings/blueprints`);
}

View File

@@ -31,7 +31,8 @@ const toastVariants = cva(
variant: {
default: "border bg-card text-foreground",
destructive:
"destructive group border-destructive bg-destructive text-white dark:text-destructive-foreground"
"destructive group border-destructive bg-destructive text-white dark:text-destructive-foreground",
warning: "group border-amber-600 bg-amber-600 text-white"
}
},
defaultVariants: {