mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Refactor: rename [:id] to [:postId] for api routes
This commit is contained in:
@@ -9,8 +9,9 @@ import {
|
||||
export const editBeerPostCommentRequest: SendEditBeerPostCommentRequest = async ({
|
||||
body,
|
||||
commentId,
|
||||
beerPostId,
|
||||
}) => {
|
||||
const response = await fetch(`/api/beer-post-comments/${commentId}`, {
|
||||
const response = await fetch(`/api/beers/${beerPostId}/comments/${commentId}`, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
@@ -33,8 +34,9 @@ export const editBeerPostCommentRequest: SendEditBeerPostCommentRequest = async
|
||||
|
||||
export const deleteBeerPostCommentRequest: SendDeleteBeerPostCommentRequest = async ({
|
||||
commentId,
|
||||
beerPostId,
|
||||
}) => {
|
||||
const response = await fetch(`/api/beer-post-comments/${commentId}`, {
|
||||
const response = await fetch(`/api/beers/${beerPostId}/comments/${commentId}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
|
||||
|
||||
@@ -5,10 +5,12 @@ import { z } from 'zod';
|
||||
export type SendEditBeerPostCommentRequest = (args: {
|
||||
body: { content: string; rating: number };
|
||||
commentId: string;
|
||||
beerPostId: string;
|
||||
}) => Promise<z.infer<typeof APIResponseValidationSchema>>;
|
||||
|
||||
export type SendDeleteBeerPostCommentRequest = (args: {
|
||||
commentId: string;
|
||||
beerPostId: string;
|
||||
}) => Promise<z.infer<typeof APIResponseValidationSchema>>;
|
||||
|
||||
export type SendCreateBeerCommentRequest = (args: {
|
||||
|
||||
Reference in New Issue
Block a user