fix(web): vocab form-level error states, newVocabulary heading, id guard, EN-required test

This commit is contained in:
2026-06-04 09:29:51 +02:00
parent ac30eadbb2
commit 02e4f34a1b
3 changed files with 29 additions and 1 deletions
+8 -1
View File
@@ -38,6 +38,8 @@ export function VocabularyTerms() {
const [error, setError] = useState(false);
if (!id) return null;
const onAdd = (event: FormEvent) => {
event.preventDefault();
@@ -49,7 +51,7 @@ export function VocabularyTerms() {
setError(false);
addTerm.mutate(
{ vocabularyId: id!, external_uri: uri.trim() || null, labels },
{ vocabularyId: id, external_uri: uri.trim() || null, labels },
{ onSuccess: () => { setLabels([]); setUri(""); } },
);
};
@@ -85,6 +87,11 @@ export function VocabularyTerms() {
{t("form.required")}
</p>
)}
{addTerm.isError && (
<p role="alert" className="text-xs text-red-600">
{t("form.rejected")}
</p>
)}
<Button type="submit" size="sm" disabled={addTerm.isPending}>
{t("vocab.addTerm")}
</Button>