Replace updateCurrentAccount() with refreshSession() (#3910)

Replace updateCurrentAccount() with resumeSession()
This commit is contained in:
dan 2024-05-08 23:11:39 +01:00 committed by GitHub
parent f62b0458a7
commit 0c6bf276dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 15 additions and 257 deletions

View file

@ -5,7 +5,7 @@ import {useLingui} from '@lingui/react'
import {cleanError} from '#/lib/strings/errors'
import {isNative} from '#/platform/detection'
import {useAgent, useSession, useSessionApi} from '#/state/session'
import {useAgent, useSession} from '#/state/session'
import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
@ -30,7 +30,6 @@ export function DisableEmail2FADialog({
const t = useTheme()
const {gtMobile} = useBreakpoints()
const {currentAccount} = useSession()
const {updateCurrentAccount} = useSessionApi()
const {getAgent} = useAgent()
const [stage, setStage] = useState<Stages>(Stages.Email)
@ -61,7 +60,7 @@ export function DisableEmail2FADialog({
token: confirmationCode.trim(),
emailAuthFactor: false,
})
updateCurrentAccount({emailAuthFactor: false})
await getAgent().resumeSession(getAgent().session!)
Toast.show(_(msg`Email 2FA disabled`))
}
control.close()