Skip to content

Commit 1975cd6

Browse files
committed
fix: preserve email value when switching login type
1 parent 7eccbf6 commit 1975cd6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/app/(uc)/signin/page.js

+4
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,18 @@ export default function Login() {
5151
watch,
5252
clearErrors,
5353
reset,
54+
setValue,
55+
getValues
5456
} = useForm();
5557
const watchAllFields = watch();
5658

5759
const handleChangeLoginType = () => {
5860
setLoginType(prevLoginType => {
5961
const loginType = prevLoginType === 'verifyCode' ? 'password' : 'verifyCode';
6062
clearErrors();
63+
const email = getValues('Email')
6164
reset();
65+
setValue('Email', email)
6266
return loginType;
6367
});
6468
};

0 commit comments

Comments
 (0)