diff --git a/client-solid/src/Components/Posts.tsx b/client-solid/src/Components/Posts.tsx index a1a1f84..4f7bc6b 100644 --- a/client-solid/src/Components/Posts.tsx +++ b/client-solid/src/Components/Posts.tsx @@ -26,12 +26,18 @@ export function Posts(): JSXElement { export function PostSegment({ post } : { post: Post }): JSXElement { const nav = useNavigate(); + const dateOfCreation = new Date(post.createdAt).toDateString() + const isEdited = ! (post.createdAt == post.updatedAt) + return (

- {post.createdAt ?? "No Creation Date"} + {dateOfCreation}

+ +

This post has been edited

+

{post.content}

diff --git a/client-solid/src/Util/api.ts b/client-solid/src/Util/api.ts index 4209cc8..095bfe6 100644 --- a/client-solid/src/Util/api.ts +++ b/client-solid/src/Util/api.ts @@ -13,6 +13,7 @@ interface Votes { export interface Post extends NewPost { id: string; createdAt: string; + updatedAt: string; votes: Votes; } @@ -91,6 +92,15 @@ export async function getComments( return data; } +/** Incomplete */ +export async function engagePost( + postId: string +): Promise { + const res = await fetch(`/api/engage_post?post_id=${postId}`); + const data = await res.json(); + return data; +} + // Send the registration request to the server export async function submitRegistration( username: string,