fix(web): vocab form-level error states, newVocabulary heading, id guard, EN-required test
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user