1627 login: onsubmit is added (#1635)

* feat: onsubmit is updated
* chore: precheckComplete handler is updated
This commit is contained in:
Palash Gupta 2022-10-13 14:20:25 +05:30 committed by GitHub
parent acd15af823
commit f580bedb1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,6 +111,8 @@ function Login({
setFunc(value); setFunc(value);
}; };
const { sso, canSelfRegister } = precheckResult;
const onSubmitHandler: React.FormEventHandler<HTMLFormElement> = async ( const onSubmitHandler: React.FormEventHandler<HTMLFormElement> = async (
event, event,
) => { ) => {
@ -123,6 +125,11 @@ function Login({
return; return;
} }
if (precheckComplete && sso) {
window.location.href = precheckResult.ssoUrl || '';
return;
}
setIsLoading(true); setIsLoading(true);
const response = await loginApi({ const response = await loginApi({
@ -176,8 +183,6 @@ function Login({
); );
}; };
const { sso, canSelfRegister } = precheckResult;
return ( return (
<FormWrapper> <FormWrapper>
<FormContainer onSubmit={onSubmitHandler}> <FormContainer onSubmit={onSubmitHandler}>