simplify gotoForm
parent
49a392bfb3
commit
b6903419a1
|
@ -65,7 +65,7 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => {
|
||||||
setCurrentForm(Forms.Login)
|
setCurrentForm(Forms.Login)
|
||||||
}
|
}
|
||||||
|
|
||||||
const gotoForm = (form: Forms) => () => {
|
const gotoForm = (form: Forms) => {
|
||||||
setError('')
|
setError('')
|
||||||
setCurrentForm(form)
|
setCurrentForm(form)
|
||||||
}
|
}
|
||||||
|
@ -132,8 +132,8 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => {
|
||||||
serviceDescription={serviceDescription}
|
serviceDescription={serviceDescription}
|
||||||
setError={setError}
|
setError={setError}
|
||||||
setServiceUrl={setServiceUrl}
|
setServiceUrl={setServiceUrl}
|
||||||
onPressBack={gotoForm(Forms.Login)}
|
onPressBack={() => gotoForm(Forms.Login)}
|
||||||
onEmailSent={gotoForm(Forms.SetNewPassword)}
|
onEmailSent={() => gotoForm(Forms.SetNewPassword)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
@ -145,15 +145,17 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => {
|
||||||
error={error}
|
error={error}
|
||||||
serviceUrl={serviceUrl}
|
serviceUrl={serviceUrl}
|
||||||
setError={setError}
|
setError={setError}
|
||||||
onPressBack={gotoForm(Forms.ForgotPassword)}
|
onPressBack={() => gotoForm(Forms.ForgotPassword)}
|
||||||
onPasswordSet={gotoForm(Forms.PasswordUpdated)}
|
onPasswordSet={() => gotoForm(Forms.PasswordUpdated)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
case Forms.PasswordUpdated:
|
case Forms.PasswordUpdated:
|
||||||
title = _(msg`Password updated`)
|
title = _(msg`Password updated`)
|
||||||
description = _(msg`You can now sign in with your new password.`)
|
description = _(msg`You can now sign in with your new password.`)
|
||||||
content = <PasswordUpdatedForm onPressNext={gotoForm(Forms.Login)} />
|
content = (
|
||||||
|
<PasswordUpdatedForm onPressNext={() => gotoForm(Forms.Login)} />
|
||||||
|
)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue