diff options
Diffstat (limited to 'src/view/screens/Settings')
-rw-r--r-- | src/view/screens/Settings/DisableEmail2FADialog.tsx | 8 | ||||
-rw-r--r-- | src/view/screens/Settings/Email2FAToggle.tsx | 8 | ||||
-rw-r--r-- | src/view/screens/Settings/ExportCarDialog.tsx | 5 |
3 files changed, 10 insertions, 11 deletions
diff --git a/src/view/screens/Settings/DisableEmail2FADialog.tsx b/src/view/screens/Settings/DisableEmail2FADialog.tsx index b52dcc7a3..a27cff9a3 100644 --- a/src/view/screens/Settings/DisableEmail2FADialog.tsx +++ b/src/view/screens/Settings/DisableEmail2FADialog.tsx @@ -30,7 +30,7 @@ export function DisableEmail2FADialog({ const t = useTheme() const {gtMobile} = useBreakpoints() const {currentAccount} = useSession() - const {getAgent} = useAgent() + const agent = useAgent() const [stage, setStage] = useState<Stages>(Stages.Email) const [confirmationCode, setConfirmationCode] = useState<string>('') @@ -41,7 +41,7 @@ export function DisableEmail2FADialog({ setError('') setIsProcessing(true) try { - await getAgent().com.atproto.server.requestEmailUpdate() + await agent.com.atproto.server.requestEmailUpdate() setStage(Stages.ConfirmCode) } catch (e) { setError(cleanError(String(e))) @@ -55,12 +55,12 @@ export function DisableEmail2FADialog({ setIsProcessing(true) try { if (currentAccount?.email) { - await getAgent().com.atproto.server.updateEmail({ + await agent.com.atproto.server.updateEmail({ email: currentAccount!.email, token: confirmationCode.trim(), emailAuthFactor: false, }) - await getAgent().resumeSession(getAgent().session!) + await agent.resumeSession(agent.session!) Toast.show(_(msg`Email 2FA disabled`)) } control.close() diff --git a/src/view/screens/Settings/Email2FAToggle.tsx b/src/view/screens/Settings/Email2FAToggle.tsx index efeb7e4d7..b5e7adddb 100644 --- a/src/view/screens/Settings/Email2FAToggle.tsx +++ b/src/view/screens/Settings/Email2FAToggle.tsx @@ -13,17 +13,17 @@ export function Email2FAToggle() { const {currentAccount} = useSession() const {openModal} = useModalControls() const disableDialogCtrl = useDialogControl() - const {getAgent} = useAgent() + const agent = useAgent() const enableEmailAuthFactor = React.useCallback(async () => { if (currentAccount?.email) { - await getAgent().com.atproto.server.updateEmail({ + await agent.com.atproto.server.updateEmail({ email: currentAccount.email, emailAuthFactor: true, }) - await getAgent().resumeSession(getAgent().session!) + await agent.resumeSession(agent.session!) } - }, [currentAccount, getAgent]) + }, [currentAccount, agent]) const onToggle = React.useCallback(() => { if (!currentAccount) { diff --git a/src/view/screens/Settings/ExportCarDialog.tsx b/src/view/screens/Settings/ExportCarDialog.tsx index af835cb62..72d943bcf 100644 --- a/src/view/screens/Settings/ExportCarDialog.tsx +++ b/src/view/screens/Settings/ExportCarDialog.tsx @@ -21,11 +21,10 @@ export function ExportCarDialog({ }) { const {_} = useLingui() const t = useTheme() - const {getAgent} = useAgent() + const agent = useAgent() const [loading, setLoading] = React.useState(false) const download = React.useCallback(async () => { - const agent = getAgent() if (!agent.session) { return // shouldnt ever happen } @@ -49,7 +48,7 @@ export function ExportCarDialog({ setLoading(false) control.close() } - }, [_, control, getAgent]) + }, [_, control, agent]) return ( <Dialog.Outer control={control}> |