Use an effect silly goose
This commit is contained in:
@@ -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,12 +15,14 @@ export function Manage2FA({showScreen}: ScreenProps<ScreenID.Manage2FA>) {
|
|||||||
'enable' | 'disable' | null
|
'enable' | 'disable' | null
|
||||||
>(null)
|
>(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
if (!isEmailVerified) {
|
if (!isEmailVerified) {
|
||||||
showScreen({
|
showScreen({
|
||||||
id: ScreenID.Verify,
|
id: ScreenID.Verify,
|
||||||
instructions: [
|
instructions: [
|
||||||
<Trans key="2fa">
|
<Trans key="2fa">
|
||||||
You need to verify your email address before you can enable email 2FA.
|
You need to verify your email address before you can enable email
|
||||||
|
2FA.
|
||||||
</Trans>,
|
</Trans>,
|
||||||
],
|
],
|
||||||
onVerify: () => {
|
onVerify: () => {
|
||||||
@@ -29,9 +31,8 @@ export function Manage2FA({showScreen}: ScreenProps<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
|
||||||
|
|||||||
Reference in New Issue
Block a user