Skip to content

Commit

Permalink
Merge pull request #363 from EscolaLMS/hotfix/login-form-errors
Browse files Browse the repository at this point in the history
fix errors in login form
  • Loading branch information
victazzz authored Nov 14, 2024
2 parents 468a77b + 89e7348 commit c26a36f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/organisms/LoginForm/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const LoginForm: React.FC<Props> = ({
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
error: user?.error?.data?.message || user?.error?.message,
...user.error.errors,
...user?.error?.errors,
});
onError?.(user.error);
} else {
Expand Down Expand Up @@ -135,7 +135,10 @@ export const LoginForm: React.FC<Props> = ({
remember_me: values.remember_me ? 1 : 0,
})
.catch((err: ResponseError<DefaultResponseError>) => {
setErrors({ error: err?.data?.message, ...err.data.errors });
setErrors({
error: err?.data?.message,
...(err?.data?.errors || {}),
});
onError?.(err?.data);
})
.finally(() => setSubmitting(false));
Expand Down

0 comments on commit c26a36f

Please sign in to comment.