From 0910525e2efe124c63c1c8147a98450e43110681 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 8 May 2024 03:30:55 +0100 Subject: [Session] Code cleanup (#3854) * Split utils into files * Move reducer to another file * Write types explicitly * Remove unnnecessary check * Move things around a bit * Move more stuff into agent factories * Move more stuff into agent * Fix gates await * Clarify comments * Enforce more via types * Nit * initSession -> resumeSession * Protect against races * Make agent opaque to reducer * Check using plain condition --- src/lib/hooks/useAccountSwitcher.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib/hooks/useAccountSwitcher.ts') diff --git a/src/lib/hooks/useAccountSwitcher.ts b/src/lib/hooks/useAccountSwitcher.ts index ad529f912..33d56eb85 100644 --- a/src/lib/hooks/useAccountSwitcher.ts +++ b/src/lib/hooks/useAccountSwitcher.ts @@ -15,7 +15,7 @@ export function useAccountSwitcher() { const [pendingDid, setPendingDid] = useState(null) const {_} = useLingui() const {track} = useAnalytics() - const {initSession} = useSessionApi() + const {resumeSession} = useSessionApi() const {requestSwitchToAccount} = useLoggedOutViewControls() const onPressSwitchAccount = useCallback( @@ -39,7 +39,7 @@ export function useAccountSwitcher() { // So we change the URL ourselves. The navigator will pick it up on remount. history.pushState(null, '', '/') } - await initSession(account) + await resumeSession(account) logEvent('account:loggedIn', {logContext, withPassword: false}) Toast.show(_(msg`Signed in as @${account.handle}`)) } else { @@ -57,7 +57,7 @@ export function useAccountSwitcher() { setPendingDid(null) } }, - [_, track, initSession, requestSwitchToAccount, pendingDid], + [_, track, resumeSession, requestSwitchToAccount, pendingDid], ) return {onPressSwitchAccount, pendingDid} -- cgit 1.4.1