diff --git a/frontend/src/hooks/queries/review/useReviewDetailQuery.ts b/frontend/src/hooks/queries/review/useReviewDetailQuery.ts index 0b9c7be20..60675ccd6 100644 --- a/frontend/src/hooks/queries/review/useReviewDetailQuery.ts +++ b/frontend/src/hooks/queries/review/useReviewDetailQuery.ts @@ -3,14 +3,14 @@ import { useSuspendedQuery } from '../useSuspendedQuery'; import { reviewApi } from '@/apis'; import type { ReviewDetailResponse } from '@/types/response'; -const fetchReviewDetail = async () => { - const response = await reviewApi.get({ params: '/reviews' }); +const fetchReviewDetail = async (reviewId: number) => { + const response = await reviewApi.get({ params: `/${reviewId}` }); const data: ReviewDetailResponse = await response.json(); return data; }; -const useReviewDetailQuery = () => { - return useSuspendedQuery(['review'], () => fetchReviewDetail()); +const useReviewDetailQuery = (reviewId: number) => { + return useSuspendedQuery(['review'], () => fetchReviewDetail(reviewId)); }; export default useReviewDetailQuery; diff --git a/frontend/src/pages/ReviewDetailPage.tsx b/frontend/src/pages/ReviewDetailPage.tsx index 92286ddc5..7447e88e2 100644 --- a/frontend/src/pages/ReviewDetailPage.tsx +++ b/frontend/src/pages/ReviewDetailPage.tsx @@ -1,4 +1,5 @@ import { Badge, Spacing, Text, useTheme } from '@fun-eat/design-system'; +import { useParams } from 'react-router-dom'; import styled from 'styled-components'; import { SectionTitle, SvgIcon, TagList } from '@/components/Common'; @@ -7,7 +8,9 @@ import { useReviewDetailQuery } from '@/hooks/queries/review'; import { getRelativeDate } from '@/utils/date'; export const ReviewDetailPage = () => { - const { data: reviewDetail } = useReviewDetailQuery(); + const { reviewId } = useParams(); + const { data: reviewDetail } = useReviewDetailQuery(Number(reviewId)); + const { productName, categoryType,