about summary refs log tree commit diff
path: root/src/lib/hooks/useAccountSwitcher.ts
diff options
context:
space:
mode:
authorAnsh <anshnanda10@gmail.com>2023-12-07 16:53:50 -0800
committerGitHub <noreply@github.com>2023-12-07 16:53:50 -0800
commit9d51886e438b1676706009d91bdcf20e8df5dd58 (patch)
tree97abc18e7ddf3c288c355ba81988c959df86908e /src/lib/hooks/useAccountSwitcher.ts
parentafca4bf70160b6b15e3fe55e2cf8ba326a30597c (diff)
downloadvoidsky-9d51886e438b1676706009d91bdcf20e8df5dd58.tar.zst
Fixes issue with (#2119)
* Allow going directly to password input screen when switching accounts and password is required

* Revise state handling

* Handle logged out states, enable clearing requestedAccount

---------

Co-authored-by: Eric Bailey <git@esb.lol>
Diffstat (limited to 'src/lib/hooks/useAccountSwitcher.ts')
-rw-r--r--src/lib/hooks/useAccountSwitcher.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/hooks/useAccountSwitcher.ts b/src/lib/hooks/useAccountSwitcher.ts
index 2f2c110d9..74b5674d5 100644
--- a/src/lib/hooks/useAccountSwitcher.ts
+++ b/src/lib/hooks/useAccountSwitcher.ts
@@ -11,7 +11,7 @@ export function useAccountSwitcher() {
   const {track} = useAnalytics()
   const {selectAccount, clearCurrentAccount} = useSessionApi()
   const closeAllActiveElements = useCloseAllActiveElements()
-  const {setShowLoggedOut} = useLoggedOutViewControls()
+  const {requestSwitchToAccount} = useLoggedOutViewControls()
 
   const onPressSwitchAccount = useCallback(
     async (account: SessionAccount) => {
@@ -34,7 +34,7 @@ export function useAccountSwitcher() {
           }, 100)
         } else {
           closeAllActiveElements()
-          setShowLoggedOut(true)
+          requestSwitchToAccount({requestedAccount: account.did})
           Toast.show(
             `Please sign in as @${account.handle}`,
             'circle-exclamation',
@@ -50,7 +50,7 @@ export function useAccountSwitcher() {
       clearCurrentAccount,
       selectAccount,
       closeAllActiveElements,
-      setShowLoggedOut,
+      requestSwitchToAccount,
     ],
   )