mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 21:06:42 +07:00
fixed error translation
This commit is contained in:
parent
455c7ad90d
commit
a7d890aeec
5 changed files with 46 additions and 11 deletions
|
@ -4,6 +4,7 @@ import styles from '~/styles/common/inputs.module.scss';
|
|||
import { Icon } from '~/components/input/Icon';
|
||||
import { IInputTextProps } from '~/redux/types';
|
||||
import { LoaderCircle } from '~/components/input/LoaderCircle';
|
||||
import { useTranslatedError } from '~/utils/hooks/useTranslatedError';
|
||||
|
||||
const InputText: FC<IInputTextProps> = ({
|
||||
wrapperClassName,
|
||||
|
@ -36,6 +37,8 @@ const InputText: FC<IInputTextProps> = ({
|
|||
const onFocus = useCallback(() => setFocused(true), []);
|
||||
const onBlur = useCallback(() => setFocused(false), []);
|
||||
|
||||
const translatedError = useTranslatedError(error);
|
||||
|
||||
useEffect(() => {
|
||||
if (onRef) onRef(inner_ref);
|
||||
}, [inner_ref, onRef]);
|
||||
|
@ -86,9 +89,9 @@ const InputText: FC<IInputTextProps> = ({
|
|||
</div>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
{!!translatedError && (
|
||||
<div className={styles.error}>
|
||||
<span>{error}</span>
|
||||
<span>{translatedError}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue