about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-03-19 15:31:00 +0000
committerSamuel Newman <mozzius@protonmail.com>2024-03-19 15:31:00 +0000
commitb6903419a1112bae5397a398756e46a46afcf65f (patch)
tree1f15473b6b1ed02f84923b4bb82cde130cf3dac4
parent49a392bfb34b91ba971f32cb25e41b0491c45fc2 (diff)
downloadvoidsky-b6903419a1112bae5397a398756e46a46afcf65f.tar.zst
simplify gotoForm
-rw-r--r--src/screens/Login/index.tsx14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/screens/Login/index.tsx b/src/screens/Login/index.tsx
index 8dee06185..f7a0e29e9 100644
--- a/src/screens/Login/index.tsx
+++ b/src/screens/Login/index.tsx
@@ -65,7 +65,7 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => {
     setCurrentForm(Forms.Login)
   }
 
-  const gotoForm = (form: Forms) => () => {
+  const gotoForm = (form: Forms) => {
     setError('')
     setCurrentForm(form)
   }
@@ -132,8 +132,8 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => {
           serviceDescription={serviceDescription}
           setError={setError}
           setServiceUrl={setServiceUrl}
-          onPressBack={gotoForm(Forms.Login)}
-          onEmailSent={gotoForm(Forms.SetNewPassword)}
+          onPressBack={() => gotoForm(Forms.Login)}
+          onEmailSent={() => gotoForm(Forms.SetNewPassword)}
         />
       )
       break
@@ -145,15 +145,17 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => {
           error={error}
           serviceUrl={serviceUrl}
           setError={setError}
-          onPressBack={gotoForm(Forms.ForgotPassword)}
-          onPasswordSet={gotoForm(Forms.PasswordUpdated)}
+          onPressBack={() => gotoForm(Forms.ForgotPassword)}
+          onPasswordSet={() => gotoForm(Forms.PasswordUpdated)}
         />
       )
       break
     case Forms.PasswordUpdated:
       title = _(msg`Password updated`)
       description = _(msg`You can now sign in with your new password.`)
-      content = <PasswordUpdatedForm onPressNext={gotoForm(Forms.Login)} />
+      content = (
+        <PasswordUpdatedForm onPressNext={() => gotoForm(Forms.Login)} />
+      )
       break
   }