-9
src/lib/hooks/useAccountSwitcher.ts
-9
src/lib/hooks/useAccountSwitcher.ts
···
3
3
import {useLingui} from '@lingui/react'
4
4
5
5
import {logger} from '#/logger'
6
-
import {isWeb} from '#/platform/detection'
7
6
import {type SessionAccount, useSessionApi} from '#/state/session'
8
7
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
9
8
import * as Toast from '#/view/com/util/Toast'
···
28
27
try {
29
28
setPendingDid(account.did)
30
29
if (account.accessJwt) {
31
-
if (isWeb) {
32
-
// We're switching accounts, which remounts the entire app.
33
-
// On mobile, this gets us Home, but on the web we also need reset the URL.
34
-
// We can't change the URL via a navigate() call because the navigator
35
-
// itself is about to unmount, and it calls pushState() too late.
36
-
// So we change the URL ourselves. The navigator will pick it up on remount.
37
-
history.pushState(null, '', '/')
38
-
}
39
30
await resumeSession(account, true)
40
31
logEvent('account:loggedIn', {logContext, withPassword: false})
41
32
Toast.show(_(msg`Signed in as @${account.handle}`))