diff options
Diffstat (limited to 'front/src/logic/requests/nostrill.ts')
-rw-r--r-- | front/src/logic/requests/nostrill.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/front/src/logic/requests/nostrill.ts b/front/src/logic/requests/nostrill.ts index 74fcb87..4147e35 100644 --- a/front/src/logic/requests/nostrill.ts +++ b/front/src/logic/requests/nostrill.ts @@ -2,7 +2,7 @@ import type Urbit from "urbit-api"; import type { Cursor, FC, PostID } from "@/types/trill"; import type { Ship } from "@/types/urbit"; import { FeedPostCount } from "../constants"; -import type { UserProfile } from "@/types/nostrill"; +import type { UserProfile, UserType } from "@/types/nostrill"; import type { AsyncRes } from "@/types/ui"; // Subscribe @@ -121,13 +121,13 @@ export default class IO { } // follows - async follow(ship: Ship) { - const json = { add: ship }; + async follow(user: UserType) { + const json = { add: user }; return this.poke({ fols: json }); } - async unfollow(ship: Ship) { - const json = { del: ship }; + async unfollow(user: UserType) { + const json = { del: user }; return await this.poke({ fols: json }); } // profiles @@ -162,7 +162,9 @@ export default class IO { } // threads // - async peekFeed(host: string): AsyncRes<FC> { + async peekFeed( + host: string, + ): AsyncRes<{ feed: FC; profile: UserProfile | null }> { try { const json = { begs: { feed: host } }; const res: any = await this.thread("beg", json); @@ -170,7 +172,7 @@ export default class IO { if (!("begs" in res)) return { error: "wrong request" }; if ("ng" in res.begs) return { error: res.begs.ng }; if (!("feed" in res.begs.ok)) return { error: "wrong request" }; - else return { ok: res.begs.ok.feed }; + else return { ok: res.begs.ok }; } catch (e) { return { error: `${e}` }; } |