chore: begin work on documenting client side requests code

This commit is contained in:
Aaron William Po
2023-09-24 01:40:18 -04:00
parent 390ac8daf9
commit 39980eb8c3
7 changed files with 102 additions and 13 deletions

View File

@@ -8,6 +8,17 @@ const BeerCommentValidationSchemaWithId = CreateCommentValidationSchema.extend({
beerPostId: z.string().cuid(),
});
/**
* Sends a POST request to the server to create a new beer comment.
*
* @param data The data to be sent to the server.
* @param data.beerPostId The ID of the beer post to comment on.
* @param data.content The content of the comment.
* @param data.rating The rating of the beer.
* @returns A promise that resolves to the created comment.
* @throws An error if the request fails, the API response is invalid, or the API response
* payload is invalid.
*/
const sendCreateBeerCommentRequest = async ({
beerPostId,
content,