Files
the-biergarten-app/requests/sendCreateBeerCommentRequest.ts
Aaron William Po 0b96c8f1f5 Did more work to beer post page, seed
Worked on comments and beer recs features. Fine tuning database seed amounts.
2023-01-29 21:53:05 -05:00

27 lines
603 B
TypeScript

import { z } from 'zod';
import BeerCommentValidationSchema from '../validation/CreateBeerCommentValidationSchema';
const sendCreateBeerCommentRequest = async ({
beerPostId,
content,
rating,
}: z.infer<typeof BeerCommentValidationSchema>) => {
const response = await fetch(`/api/beers/${beerPostId}/comments`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
beerPostId,
content,
rating,
}),
});
const data = await response.json();
console.log(data);
};
export default sendCreateBeerCommentRequest;