mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-07 11:16:37 +00:00
♻️ show warning toast and do not throw error in case of UI source
This commit is contained in:
@@ -166,7 +166,8 @@ export async function applyBlueprint({
|
|||||||
blueprint = newBlueprint[0];
|
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";
|
throw error ?? "Unknown Server Error";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,10 +107,11 @@ export default function CreateBlueprintForm({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (res && res.status === 201) {
|
if (res && res.status === 201) {
|
||||||
|
const createdBlueprint = res.data.data;
|
||||||
toast({
|
toast({
|
||||||
variant: "default",
|
variant: "warning",
|
||||||
title: "Success",
|
title: createdBlueprint.succeeded ? "Success" : "Warning",
|
||||||
description: res.data.data.message
|
description: createdBlueprint.message
|
||||||
});
|
});
|
||||||
router.push(`/${orgId}/settings/blueprints`);
|
router.push(`/${orgId}/settings/blueprints`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ const toastVariants = cva(
|
|||||||
variant: {
|
variant: {
|
||||||
default: "border bg-card text-foreground",
|
default: "border bg-card text-foreground",
|
||||||
destructive:
|
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: {
|
defaultVariants: {
|
||||||
|
|||||||
Reference in New Issue
Block a user