mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at no-pointer-events 41 lines 870 B view raw
1import { 2 AppBskyFeedDefs, 3 AppBskyFeedGetActorLikes as GetActorLikes, 4} from '@atproto/api' 5import {FeedAPI, FeedAPIResponse} from './types' 6import {getAgent} from '#/state/session' 7 8export class LikesFeedAPI implements FeedAPI { 9 constructor(public params: GetActorLikes.QueryParams) {} 10 11 async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> { 12 const res = await getAgent().getActorLikes({ 13 ...this.params, 14 limit: 1, 15 }) 16 return res.data.feed[0] 17 } 18 19 async fetch({ 20 cursor, 21 limit, 22 }: { 23 cursor: string | undefined 24 limit: number 25 }): Promise<FeedAPIResponse> { 26 const res = await getAgent().getActorLikes({ 27 ...this.params, 28 cursor, 29 limit, 30 }) 31 if (res.success) { 32 return { 33 cursor: res.data.cursor, 34 feed: res.data.feed, 35 } 36 } 37 return { 38 feed: [], 39 } 40 } 41}