[Session] Align state and global agent switchpoints (#3845)
* Adopt synced accounts unconditionally * Remove try/catch around resuming session * Move to login form on resume failure * Restructure code flow for easier reading --------- Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
parent
85b34418ef
commit
4a2d4253e5
3 changed files with 50 additions and 70 deletions
|
@ -15,7 +15,7 @@ export function useAccountSwitcher() {
|
|||
const [pendingDid, setPendingDid] = useState<string | null>(null)
|
||||
const {_} = useLingui()
|
||||
const {track} = useAnalytics()
|
||||
const {initSession, clearCurrentAccount} = useSessionApi()
|
||||
const {initSession} = useSessionApi()
|
||||
const {requestSwitchToAccount} = useLoggedOutViewControls()
|
||||
|
||||
const onPressSwitchAccount = useCallback(
|
||||
|
@ -53,19 +53,11 @@ export function useAccountSwitcher() {
|
|||
logger.error(`switch account: selectAccount failed`, {
|
||||
message: e.message,
|
||||
})
|
||||
clearCurrentAccount() // back user out to login
|
||||
} finally {
|
||||
setPendingDid(null)
|
||||
}
|
||||
},
|
||||
[
|
||||
_,
|
||||
track,
|
||||
clearCurrentAccount,
|
||||
initSession,
|
||||
requestSwitchToAccount,
|
||||
pendingDid,
|
||||
],
|
||||
[_, track, initSession, requestSwitchToAccount, pendingDid],
|
||||
)
|
||||
|
||||
return {onPressSwitchAccount, pendingDid}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue