Skip to content

Commit df6c2f4

Browse files
committed
Fix forms
1 parent dc39c82 commit df6c2f4

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/components/Main/Authentication/Login/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const Login = ({
3434
handleSubmit,
3535
control,
3636
clearErrors,
37-
watch,
37+
subscribe,
3838
setError,
3939
getValues,
4040
formState: { errors, isValid },
@@ -61,10 +61,12 @@ export const Login = ({
6161
}, [setError, error]);
6262

6363
useEffect(() => {
64-
watch(() => {
65-
clearErrors();
64+
subscribe({
65+
callback: () => {
66+
clearErrors();
67+
}
6668
});
67-
}, [clearErrors, watch]);
69+
}, [clearErrors, subscribe]);
6870

6971
const onSubmit = (data: LoginFormValues) => {
7072
onLogin();

src/components/Main/Authentication/Registration/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const Registration = ({ onRegister }: RegistrationProps) => {
5151
handleSubmit,
5252
control,
5353
getValues,
54-
watch,
54+
subscribe,
5555
setError,
5656
clearErrors,
5757
resetField,
@@ -82,10 +82,12 @@ export const Registration = ({ onRegister }: RegistrationProps) => {
8282
}, [setFocus]);
8383

8484
useEffect(() => {
85-
watch(() => {
86-
setResponseStatus(undefined);
85+
subscribe({
86+
callback: () => {
87+
setResponseStatus(undefined);
88+
}
8789
});
88-
}, [clearErrors, watch, setResponseStatus]);
90+
}, [clearErrors, subscribe, setResponseStatus]);
8991

9092
useEffect(() => {
9193
if (isSucceed) {

0 commit comments

Comments
 (0)