feat(web): adopt MutationError across create/object forms; distinguish edit-form fetch error (#63)
This commit is contained in:
@@ -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")}
|
||||
|
||||
Reference in New Issue
Block a user