about summary refs log tree commit diff
path: root/src/state/session/types.ts
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-05-08 03:30:55 +0100
committerGitHub <noreply@github.com>2024-05-08 03:30:55 +0100
commit0910525e2efe124c63c1c8147a98450e43110681 (patch)
tree58162303b6c224e9ad90c552f66e29c7415bece4 /src/state/session/types.ts
parent4fe5a869c32c696862308cb8ff4537f34f43f06a (diff)
downloadvoidsky-0910525e2efe124c63c1c8147a98450e43110681.tar.zst
[Session] Code cleanup (#3854)
* Split utils into files

* Move reducer to another file

* Write types explicitly

* Remove unnnecessary check

* Move things around a bit

* Move more stuff into agent factories

* Move more stuff into agent

* Fix gates await

* Clarify comments

* Enforce more via types

* Nit

* initSession -> resumeSession

* Protect against races

* Make agent opaque to reducer

* Check using plain condition
Diffstat (limited to 'src/state/session/types.ts')
-rw-r--r--src/state/session/types.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/state/session/types.ts b/src/state/session/types.ts
index b9fd31502..b74eeddcb 100644
--- a/src/state/session/types.ts
+++ b/src/state/session/types.ts
@@ -8,6 +8,7 @@ export type SessionStateContext = {
   currentAccount: SessionAccount | undefined
   hasSession: boolean
 }
+
 export type SessionApiContext = {
   createAccount: (props: {
     service: string
@@ -33,10 +34,8 @@ export type SessionApiContext = {
    * access tokens from all accounts, so that returning as any user will
    * require a full login.
    */
-  logout: (
-    logContext: LogEvents['account:loggedOut']['logContext'],
-  ) => Promise<void>
-  initSession: (account: SessionAccount) => Promise<void>
+  logout: (logContext: LogEvents['account:loggedOut']['logContext']) => void
+  resumeSession: (account: SessionAccount) => Promise<void>
   removeAccount: (account: SessionAccount) => void
   updateCurrentAccount: (
     account: Partial<