4wswt4ex2: Add like and unlike for post cards
This commit is contained in:
@@ -18,6 +18,8 @@ export interface CardPost {
|
||||
time: number;
|
||||
text: string;
|
||||
likesCount: number;
|
||||
/** Whether the signed-in person has liked the post. */
|
||||
isLiked: boolean;
|
||||
commentsCount: number;
|
||||
media: CardMedia[];
|
||||
}
|
||||
@@ -99,6 +101,7 @@ export function toCardPost(item: unknown, index = 0): CardPost | null {
|
||||
time: Number.isFinite(t) ? t : Number.NEGATIVE_INFINITY,
|
||||
text: typeof post.content === "string" ? post.content : "",
|
||||
likesCount: num(item.likesCount ?? post.likesCount),
|
||||
isLiked: post.isLiked === true || item.isLiked === true,
|
||||
commentsCount: num(item.commentsCount ?? post.commentsCount),
|
||||
media: toMedia(post.mediaItems),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user