Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
indpurvesh committed May 27, 2024
1 parent 9e90ce1 commit 69dc177
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions react-admin/src/pages/auth/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useTranslation } from "react-i18next";
function Login() {
const [t, i18] = useTranslation("global");
const redirect = useNavigate();
const { register, handleSubmit } = useForm({
const { register, handleSubmit, formState: { errors } } = useForm({
// Removed "formState: { errors }" from the object
resolver: joiResolver(loginSchema),
});
Expand All @@ -25,15 +25,15 @@ function Login() {
};

const isErrorExist = (key) => {
let message = errors[key]?.message;
let message = _.get(errors, key + '.message');
if (message) {
return 1;
}
return _.findIndex(_.get(error, 'response.data.errors', []), ((err) => err.key === key))
}

const getErrorMessage = (key) => {
let message = errors[key]?.message;
let message = _.get(errors, key + '.message');
if (message) {
return message;
}
Expand Down

0 comments on commit 69dc177

Please sign in to comment.