use xrpc dispatcher

This commit is contained in:
Matthieu Sieben
2024-05-02 13:29:33 +02:00
parent be26e9b017
commit e3e1a5c7a9
5 changed files with 26 additions and 20 deletions
+2 -2
View File
@@ -37,14 +37,14 @@ export function usePreferencesQuery() {
refetchOnWindowFocus: true,
queryKey: preferencesQueryKey,
queryFn: async () => {
if (agent.session?.did === undefined) {
if (!agent.did) {
return DEFAULT_LOGGED_OUT_PREFERENCES
} else {
const res = await agent.getPreferences()
// save to local storage to ensure there are labels on initial requests
saveLabelers(
agent.session.did,
agent.did,
res.moderationPrefs.labelers.map(l => l.did),
)
+10 -1
View File
@@ -1,5 +1,14 @@
<<<<<<< HEAD
import {AtpSessionData, AtpSessionEvent, BskyAgent} from '@atproto/api'
import {TID} from '@atproto/common-web'
=======
import {
AtpSessionData,
AtpSessionEvent,
BskyAgent,
SessionDispatcher,
} from '@atproto/api'
>>>>>>> 1a535b0b7 (use xrpc dispatcher)
import {networkRetry} from '#/lib/async/retry'
import {
@@ -35,7 +44,7 @@ export async function createAgentAndResume(
) {
const agent = new BskyAgent({service: storedAccount.service})
if (storedAccount.pdsUrl) {
agent.pdsUrl = agent.api.xrpc.uri = new URL(storedAccount.pdsUrl)
agent.sessionManager.pdsUrl = new URL(storedAccount.pdsUrl)
}
const gates = tryFetchGates(storedAccount.did, 'prefer-low-latency')
const moderation = configureModerationForAccount(agent, storedAccount)