mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Did more work to beer post page, seed
Worked on comments and beer recs features. Fine tuning database seed amounts.
This commit is contained in:
26
requests/sendCreateBeerCommentRequest.ts
Normal file
26
requests/sendCreateBeerCommentRequest.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
@@ -1,4 +1,4 @@
|
||||
import BeerPostValidationSchema from '@/validation/BeerPostValidationSchema';
|
||||
import BeerPostValidationSchema from '@/validation/CreateBeerPostValidationSchema';
|
||||
import APIResponseValidationSchema from '@/validation/APIResponseValidationSchema';
|
||||
import { z } from 'zod';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user