This repository has no description
1import { AtpAgent } from '@atproto/api';
2import { cache } from 'react';
3
4export const getBlueskyPost = cache(async (uri: string) => {
5 const agent = new AtpAgent({ service: 'https://public.api.bsky.app' });
6
7 const post = await agent.getPostThread({
8 uri: uri,
9 depth: 0,
10 parentHeight: 0,
11 });
12
13 if (!post.success) {
14 throw new Error('Could not load bluesky post');
15 }
16
17 return post.data;
18});