Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh committed Oct 24, 2023
1 parent 581f953 commit 6bbde98
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/pages/Oauth/AuthForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ export const OrDivider = () => {

const AuthForm: React.FC<AuthFormProps> = ({ formConfig, signInWithEth, flowStatus, disableEth }) => {
const { processingSignIn } = flowStatus
const loginMethods = getSupportLoginMethods(formConfig)

const hasEth = loginMethods.includes(LoginMethod.ETH)
const hasGoogle = loginMethods.includes(LoginMethod.GOOGLE)
const hasEmail = loginMethods.includes(LoginMethod.EMAIL)

const nodes = useMemo(() => {
const loginMethods = getSupportLoginMethods(formConfig)
const hasEth = loginMethods.includes(LoginMethod.ETH)
const hasGoogle = loginMethods.includes(LoginMethod.GOOGLE)
const hasEmail = loginMethods.includes(LoginMethod.EMAIL)

const nodes = []
if (hasEmail) nodes.push(<EmailLoginForm flowStatus={flowStatus} />)
if (hasEth)
Expand All @@ -62,7 +62,7 @@ const AuthForm: React.FC<AuthFormProps> = ({ formConfig, signInWithEth, flowStat
)
if (hasGoogle) nodes.push(<ButtonGoogle flowStatus={flowStatus} primary={!hasEmail && !hasEth} />)
return nodes
}, [disableEth, flowStatus, hasEmail, hasEth, hasGoogle, processingSignIn, signInWithEth])
}, [disableEth, flowStatus, formConfig, processingSignIn, signInWithEth])

if (!formConfig) return null
const { ui } = formConfig
Expand Down

0 comments on commit 6bbde98

Please sign in to comment.