Comment count API endpoint
This commit is contained in:
parent
5eeed1e8bc
commit
85c2161a4d
4 changed files with 56 additions and 2 deletions
|
|
@ -95,6 +95,17 @@ export async function getComments(
|
|||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total amount of comments for a post
|
||||
* @param postId The id of the post
|
||||
* @returns {Promise<number>} A promise that contains the number of comments
|
||||
*/
|
||||
export async function getCommentCount(postId: string): Promise<number> {
|
||||
const res = await fetch(`/api/posts/${postId}/comments/count`);
|
||||
const data = await res.json();
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Engagement counts for a post by postId
|
||||
* @param postId The id of the post
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue