Refactor: rename [:id] to [:postId] for api routes

This commit is contained in:
Aaron William Po
2023-12-24 12:34:51 -05:00
parent b21924b89c
commit 0e99782557
36 changed files with 118 additions and 105 deletions

View File

@@ -28,7 +28,7 @@ const BeerStyleCommentsSection: FC<BeerStyleCommentsSectionProps> = ({ beerStyle
const commentSectionRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
const handleDeleteRequest = async (id: string) => {
const response = await fetch(`/api/beer-style-comments/${id}`, {
const response = await fetch(`/api/beers/styles/${beerStyle.id}/comments/${id}`, {
method: 'DELETE',
});
@@ -41,7 +41,7 @@ const BeerStyleCommentsSection: FC<BeerStyleCommentsSectionProps> = ({ beerStyle
id: string,
data: z.infer<typeof CreateCommentValidationSchema>,
) => {
const response = await fetch(`/api/beer-style-comments/${id}`, {
const response = await fetch(`/api/beers/styles/${beerStyle.id}/comments/${id}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ content: data.content, rating: data.rating }),