File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
src/components/Main/Authentication Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments