feat(web): adopt MutationError across create/object forms; distinguish edit-form fetch error (#63)

This commit is contained in:
2026-06-08 17:32:36 +02:00
parent 6e02ac874f
commit aeb1b084d9
7 changed files with 31 additions and 30 deletions
+2 -6
View File
@@ -8,6 +8,7 @@ import {
useVocabularies,
} from "../api/queries";
import { LabelEditor } from "../components/label-editor";
import { MutationError } from "../components/mutation-error";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
@@ -95,7 +96,6 @@ export function FieldForm({
};
const pending = isEdit ? update.isPending : create.isPending;
const failed = isEdit ? update.isError : create.isError;
return (
<form onSubmit={onSubmit} className="space-y-3 overflow-auto p-4">
@@ -198,11 +198,7 @@ export function FieldForm({
{t("form.required")}
</p>
)}
{failed && (
<p role="alert" className="text-xs text-destructive">
{t("form.rejected")}
</p>
)}
<MutationError error={isEdit ? update.error : create.error} />
<Button type="submit" size="sm" disabled={pending}>
{isEdit ? t("actions.save") : t("fields.create")}