about summary refs log tree commit diff
path: root/src/state/session/index.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-06-19 02:47:50 +0300
committerGitHub <noreply@github.com>2024-06-19 02:47:50 +0300
commit7ddbc392c38393db922e47c0a7f56f6855de8152 (patch)
tree645c434b775b4b93a4d8838eec548cfe95addd9c /src/state/session/index.tsx
parent5159495274934256038b3bd04d01e614a1ee064b (diff)
downloadvoidsky-7ddbc392c38393db922e47c0a7f56f6855de8152.tar.zst
[Session] Convert account to session data explicitly (#4446)
* Extract a variable

* Extract sessionAccountToSession

* Convert account to session data on assignment
Diffstat (limited to 'src/state/session/index.tsx')
-rw-r--r--src/state/session/index.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/state/session/index.tsx b/src/state/session/index.tsx
index 371bd459a..314945bcf 100644
--- a/src/state/session/index.tsx
+++ b/src/state/session/index.tsx
@@ -14,6 +14,7 @@ import {
   createAgentAndCreateAccount,
   createAgentAndLogin,
   createAgentAndResume,
+  sessionAccountToSession,
 } from './agent'
 import {getInitialState, reducer} from './reducer'
 
@@ -175,8 +176,8 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
         if (syncedAccount.did !== state.currentAgentState.did) {
           resumeSession(syncedAccount)
         } else {
-          // @ts-ignore we checked for `refreshJwt` above
-          state.currentAgentState.agent.session = syncedAccount
+          const agent = state.currentAgentState.agent as BskyAgent
+          agent.session = sessionAccountToSession(syncedAccount)
         }
       }
     })