Prep for v2 by catching errors from initSession
This commit is contained in:
@@ -5,6 +5,7 @@ import {useLingui} from '@lingui/react'
|
|||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
import {useAnalytics} from '#/lib/analytics/analytics'
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
|
import {logger} from '#/logger'
|
||||||
import {SessionAccount, useSession, useSessionApi} from '#/state/session'
|
import {SessionAccount, useSession, useSessionApi} from '#/state/session'
|
||||||
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
import * as Toast from '#/view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
@@ -38,15 +39,22 @@ export const ChooseAccountForm = ({
|
|||||||
setShowLoggedOut(false)
|
setShowLoggedOut(false)
|
||||||
Toast.show(_(msg`Already signed in as @${account.handle}`))
|
Toast.show(_(msg`Already signed in as @${account.handle}`))
|
||||||
} else {
|
} else {
|
||||||
await initSession(account)
|
try {
|
||||||
logEvent('account:loggedIn', {
|
await initSession(account)
|
||||||
logContext: 'ChooseAccountForm',
|
logEvent('account:loggedIn', {
|
||||||
withPassword: false,
|
logContext: 'ChooseAccountForm',
|
||||||
})
|
withPassword: false,
|
||||||
track('Sign In', {resumedSession: true})
|
})
|
||||||
setTimeout(() => {
|
track('Sign In', {resumedSession: true})
|
||||||
Toast.show(_(msg`Signed in as @${account.handle}`))
|
setTimeout(() => {
|
||||||
}, 100)
|
Toast.show(_(msg`Signed in as @${account.handle}`))
|
||||||
|
}, 100)
|
||||||
|
} catch (e: any) {
|
||||||
|
logger.error('choose account: initSession failed', {
|
||||||
|
message: e.message,
|
||||||
|
})
|
||||||
|
onSelectAccount(account)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
onSelectAccount(account)
|
onSelectAccount(account)
|
||||||
|
|||||||
Reference in New Issue
Block a user