fix(web): name the field in the edit banner on create->fields-error redirect (#28)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,9 +17,11 @@ export function ObjectEditForm() {
|
|||||||
|
|
||||||
const locationState = location.state as { fieldsError?: boolean; fieldErrorKey?: string } | null;
|
const locationState = location.state as { fieldsError?: boolean; fieldErrorKey?: string } | null;
|
||||||
|
|
||||||
const [error, setError] = useState<string | null>(
|
const [error, setError] = useState<string | null>(() => {
|
||||||
locationState?.fieldsError ? t("form.rejected") : null,
|
if (locationState?.fieldErrorKey) return t("form.fieldRejected", { field: locationState.fieldErrorKey });
|
||||||
);
|
if (locationState?.fieldsError) return t("form.rejected");
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
const [fieldErrorKey, setFieldErrorKey] = useState<string | null>(
|
const [fieldErrorKey, setFieldErrorKey] = useState<string | null>(
|
||||||
locationState?.fieldErrorKey ?? null,
|
locationState?.fieldErrorKey ?? null,
|
||||||
|
|||||||
Reference in New Issue
Block a user