fix(frontend): add error prop to password input

Signed-off-by: Avinash <avinash.kumar.cs92@gmail.com>
This commit is contained in:
Avinash 2023-01-19 11:35:42 +05:30 committed by Philip Molares
parent 58819f6018
commit dae3b9d8dc
4 changed files with 24 additions and 8 deletions

View file

@ -19,16 +19,21 @@ interface PasswordAgainFieldProps extends CommonFieldProps {
* @param value The currently entered retype of the password.
* @param password The password entered into the password input field.
*/
export const PasswordAgainField: React.FC<PasswordAgainFieldProps> = ({ onChange, value, password }) => {
export const PasswordAgainField: React.FC<PasswordAgainFieldProps> = ({
onChange,
value,
password,
hasError = false
}) => {
const { t } = useTranslation()
const isInvalid = useMemo(() => {
return value !== '' && password !== value
}, [password, value])
return value !== '' && password !== value && hasError
}, [password, value, hasError])
const isValid = useMemo(() => {
return password !== '' && password === value
}, [password, value])
return password !== '' && password === value && !hasError
}, [password, value, hasError])
return (
<Form.Group>