Use an effect silly goose

This commit is contained in:
Eric Bailey
2025-05-02 15:39:25 -05:00
parent 07b96f99fc
commit 8f747f0cb9
@@ -1,4 +1,4 @@
import {useState} from 'react' import {useEffect, useState} from 'react'
import {Trans} from '@lingui/macro' import {Trans} from '@lingui/macro'
import {useAccountEmailState} from '#/components/dialogs/EmailDialog/data/useAccountEmailState' import {useAccountEmailState} from '#/components/dialogs/EmailDialog/data/useAccountEmailState'
@@ -15,23 +15,24 @@ export function Manage2FA({showScreen}: ScreenProps<ScreenID.Manage2FA>) {
'enable' | 'disable' | null 'enable' | 'disable' | null
>(null) >(null)
if (!isEmailVerified) { useEffect(() => {
showScreen({ if (!isEmailVerified) {
id: ScreenID.Verify, showScreen({
instructions: [ id: ScreenID.Verify,
<Trans key="2fa"> instructions: [
You need to verify your email address before you can enable email 2FA. <Trans key="2fa">
</Trans>, You need to verify your email address before you can enable email
], 2FA.
onVerify: () => { </Trans>,
showScreen({ ],
id: ScreenID.Manage2FA, onVerify: () => {
}) showScreen({
}, id: ScreenID.Manage2FA,
}) })
},
return null })
} }
}, [isEmailVerified, showScreen])
/* /*
* Wacky state handling so that once 2FA settings change, we don't show the * Wacky state handling so that once 2FA settings change, we don't show the