···
// - display loading notice when fetching existing session
4
-
// - rework oauth as implementation fleshes out
5
-
// - split in multiple files?
···
import { createStore } from "solid-js/store";
import { Agent } from "@atproto/api";
21
-
} from "@atproto/oauth-client-browser";
16
+
import { BrowserOAuthClient } from "@atproto/oauth-client-browser";
···
53
-
let appAgent: Agent;
56
-
const result: undefined | OAuthSession = await client.init().catch(() => {});
51
+
const result = await client.init().catch(() => {});
59
-
const init = await client.init();
60
-
appAgent = new Agent(init!.session);
54
+
agent = new Agent(result.session);
62
-
const res = await appAgent.getProfile({ actor: appAgent.did! });
56
+
const res = await agent.getProfile({ actor: agent.did! });
userHandle = res.data.handle;
···
const logoutBsky = async () => {
79
-
if (result) await client.revoke(result.sub);
73
+
if (result) await client.revoke(result.session.sub);
const Follows: Component = () => {
···
const fetchFollows = async () => {
const fetchPage = async (cursor?: any) => {
208
-
return await appAgent.com.atproto.repo.listRecords({
209
-
repo: appAgent.did!,
202
+
return await agent.com.atproto.repo.listRecords({
collection: "app.bsky.graph.follow",
···
setFollowCount(follows.length);
235
-
const res = await appAgent.getProfile({
229
+
const res = await agent.getProfile({
actor: record.value.subject,
···
viewer.blocking || viewer.blockingByList
? RepoStatus.BLOCKEDBY | RepoStatus.BLOCKING
247
-
} else if (res.data.did.includes(appAgent.did!)) {
241
+
} else if (res.data.did.includes(agent.did!)) {
status = RepoStatus.YOURSELF;
} else if (viewer.blocking || viewer.blockingByList) {
status = RepoStatus.BLOCKING;
···
for (let i = 0; i < writes.length; i += BATCHSIZE) {
315
-
await appAgent.com.atproto.repo.applyWrites({
316
-
repo: appAgent.did!,
309
+
await agent.com.atproto.repo.applyWrites({
writes: writes.slice(i, i + BATCHSIZE),