MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / loader

Function loader

src/Components/Post/PostContent/PostContent.jsx:33–45  ·  view source on GitHub ↗
({params})

Source from the content-addressed store, hash-verified

31}
32
33export async function loader({params}) {
34 const postId = decodePathParam(params.postId);
35 const {post: postObj, comments} = await getPostThread(postId);
36
37 const authorId = postObj?.author;
38 const currentDisplayName = await getDisplayName();
39 const editable = Boolean(authorId && currentDisplayName && authorId === currentDisplayName);
40
41 const metadata = authorId ? await getMetadata(authorId.split("@")[0]) : {};
42 const avatar = await getAvatar(metadata?.Avatar, authorId);
43 const latestYear = metadata?.latestYear;
44 return {postObj, comments, editable, avatar, latestYear, urlPostId: postId, currentDisplayName};
45}
46
47export async function action({request, params}) {
48 const postId = decodePathParam(params.postId);

Callers

nothing calls this directly

Calls 5

decodePathParamFunction · 0.90
getPostThreadFunction · 0.90
getDisplayNameFunction · 0.90
getMetadataFunction · 0.90
getAvatarFunction · 0.90

Tested by

no test coverage detected