Handlers for GET and POST engages added, renders numbers of unique engagements per post
This commit is contained in:
parent
efcdaf0cd2
commit
ea25fa9489
4 changed files with 75 additions and 27 deletions
|
|
@ -90,9 +90,13 @@ export async function getComments(
|
|||
return data;
|
||||
}
|
||||
|
||||
/** Incomplete */
|
||||
export async function engagePost(postId: string): Promise<void> {
|
||||
const res = await fetch(`/api/engage_post?post_id=${postId}`);
|
||||
/**
|
||||
* Gets the Engagement counts for a post by postId
|
||||
* @param postId The id of the post
|
||||
* @returns {Promise<number>} A promise that contains number of post engages
|
||||
*/
|
||||
export async function getEngagementCount(postId: string): Promise<number> {
|
||||
const res = await fetch(`/api/posts/${postId}/engage`);
|
||||
const data = await res.json();
|
||||
return data;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue