Hotfix: Signup fix error not shown (#3815)

* Fix error not shown

* Simplifying

* Removing dead code
This commit is contained in:
Leo Giovanetti 2022-08-11 20:48:58 -03:00 committed by GitHub
parent a2a5d48037
commit f57726dc95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,25 +55,17 @@ function HintsOrErrors<T extends FieldValues = FieldValues>(props: {
if (!hintErrors && fieldErrors && !fieldErrors.message) {
// no hints passed, field errors exist and they are custom ones
return (
<>
{fieldErrors?.message && (
<div className="text-gray mt-2 flex items-center text-sm text-red-700">
<Info className="mr-1 h-3 w-3" />
{fieldErrors.message}
</div>
)}
<div className="text-gray mt-2 flex items-center text-sm text-gray-700">
<ul className="ml-2">
{Object.keys(fieldErrors).map((key: string) => {
return (
<li key={key} className="text-blue-700">
{t(`${fieldName}_hint_${key}`)}
</li>
);
})}
</ul>
</div>
</>
<div className="text-gray mt-2 flex items-center text-sm text-gray-700">
<ul className="ml-2">
{Object.keys(fieldErrors).map((key: string) => {
return (
<li key={key} className="text-blue-700">
{t(`${fieldName}_hint_${key}`)}
</li>
);
})}
</ul>
</div>
);
}
@ -107,6 +99,16 @@ function HintsOrErrors<T extends FieldValues = FieldValues>(props: {
);
}
// errors exist, not custom ones, just show them as is
if (fieldErrors) {
return (
<div className="text-gray mt-2 flex items-center text-sm text-red-700">
<Info className="mr-1 h-3 w-3" />
{fieldErrors.message}
</div>
);
}
if (!hintErrors) return null;
// hints passed, no errors exist, proceed to just show hints