use it for switch account as well
This commit is contained in:
@@ -6,7 +6,6 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {useAccountSwitcher} from '#/lib/hooks/useAccountSwitcher'
|
import {useAccountSwitcher} from '#/lib/hooks/useAccountSwitcher'
|
||||||
import {type SessionAccount, useSession} from '#/state/session'
|
import {type SessionAccount, useSession} from '#/state/session'
|
||||||
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
import {useCloseAllActiveElements} from '#/state/util'
|
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
import {AccountList} from '../AccountList'
|
import {AccountList} from '../AccountList'
|
||||||
@@ -21,7 +20,6 @@ export function SwitchAccountDialog({
|
|||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
const {onPressSwitchAccount} = useAccountSwitcher()
|
const {onPressSwitchAccount} = useAccountSwitcher()
|
||||||
const {setShowLoggedOut} = useLoggedOutViewControls()
|
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
const closeAllActiveElements = useCloseAllActiveElements()
|
|
||||||
|
|
||||||
const onSelectAccount = useCallback(
|
const onSelectAccount = useCallback(
|
||||||
(account: SessionAccount) => {
|
(account: SessionAccount) => {
|
||||||
@@ -37,9 +35,10 @@ export function SwitchAccountDialog({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const onPressAddAccount = useCallback(() => {
|
const onPressAddAccount = useCallback(() => {
|
||||||
|
control.close(() => {
|
||||||
setShowLoggedOut(true)
|
setShowLoggedOut(true)
|
||||||
closeAllActiveElements()
|
})
|
||||||
}, [setShowLoggedOut, closeAllActiveElements])
|
}, [setShowLoggedOut, control])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog.Outer control={control}>
|
<Dialog.Outer control={control}>
|
||||||
|
|||||||
Reference in New Issue
Block a user