diff options
author | Eric Bailey <git@esb.lol> | 2024-04-25 10:35:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-25 10:35:21 -0500 |
commit | 6aded4f257fc85c50d57dc6334fa2a896e207aa5 (patch) | |
tree | 801994fe889bbd25a1a80dbb08dbf57e9f07d255 /src/state | |
parent | 5b82b1500720cc959d90471432b84c09d2f86388 (diff) | |
download | voidsky-6aded4f257fc85c50d57dc6334fa2a896e207aa5.tar.zst |
[Session] Base (#3541)
* Add readLastActiveAccount to use accounts[] as source of truth * Add public service constant, use
Diffstat (limited to 'src/state')
-rw-r--r-- | src/state/queries/index.ts | 4 | ||||
-rw-r--r-- | src/state/session/util/readLastActiveAccount.ts | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/state/queries/index.ts b/src/state/queries/index.ts index e7c5f577b..e30528ca1 100644 --- a/src/state/queries/index.ts +++ b/src/state/queries/index.ts @@ -1,7 +1,9 @@ import {BskyAgent} from '@atproto/api' +import {PUBLIC_BSKY_SERVICE} from '#/lib/constants' + export const PUBLIC_BSKY_AGENT = new BskyAgent({ - service: 'https://public.api.bsky.app', + service: PUBLIC_BSKY_SERVICE, }) export const STALE = { diff --git a/src/state/session/util/readLastActiveAccount.ts b/src/state/session/util/readLastActiveAccount.ts new file mode 100644 index 000000000..e0768b8a8 --- /dev/null +++ b/src/state/session/util/readLastActiveAccount.ts @@ -0,0 +1,6 @@ +import * as persisted from '#/state/persisted' + +export function readLastActiveAccount() { + const {currentAccount, accounts} = persisted.get('session') + return accounts.find(a => a.did === currentAccount?.did) +} |