Skip to content

Commit

Permalink
fix: 리뷰 상세 api 수정 (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
hae-on authored Oct 19, 2023
1 parent 826e713 commit 3f77bf1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 42 deletions.
4 changes: 2 additions & 2 deletions frontend/src/hooks/queries/review/useReviewDetailQuery.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useSuspendedQuery } from '../useSuspendedQuery';

import { reviewApi } from '@/apis';
import type { ReviewDetailResponse } from '@/types/response';
import type { ReviewDetail } from '@/types/review';

const fetchReviewDetail = async (reviewId: number) => {
const response = await reviewApi.get({ params: `/${reviewId}` });
const data: ReviewDetailResponse = await response.json();
const data: ReviewDetail = await response.json();
return data;
};

Expand Down
52 changes: 25 additions & 27 deletions frontend/src/mocks/data/reviewDetail.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
{
"reviews": {
"id": 1,
"userName": "펀잇",
"profileImage": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/1f0fd418-131c-4cf8-b540-112d762b7c34",
"image": "https://i.namu.wiki/i/9wnvUaEa1EkDqG-M0Pbwfdf19FJQQXV_-bnlU2SYaNcG05y2wbabiIrfrGES1M4xSgDjY39RwOvLNggDd3Huuw.webp",
"rating": 4.5,
"tags": [
{
"id": 5,
"name": "단짠단짠",
"tagType": "TASTE"
},
{
"id": 1,
"name": "망고망고",
"tagType": "TASTE"
}
],
"content": "맛있어용~!~!",
"rebuy": true,
"favoriteCount": 1320,
"favorite": true,
"createdAt": "2023-10-13T00:00:00",
"categoryType": "food",
"productId": 1,
"productName": "칠성 사이다"
}
"id": 1,
"userName": "펀잇",
"profileImage": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/1f0fd418-131c-4cf8-b540-112d762b7c34",
"image": "https://i.namu.wiki/i/9wnvUaEa1EkDqG-M0Pbwfdf19FJQQXV_-bnlU2SYaNcG05y2wbabiIrfrGES1M4xSgDjY39RwOvLNggDd3Huuw.webp",
"rating": 4.5,
"tags": [
{
"id": 5,
"name": "단짠단짠",
"tagType": "TASTE"
},
{
"id": 1,
"name": "망고망고",
"tagType": "TASTE"
}
],
"content": "맛있어용~!~!",
"rebuy": true,
"favoriteCount": 1320,
"favorite": true,
"createdAt": "2023-10-13T00:00:00",
"categoryType": "food",
"productId": 1,
"productName": "칠성 사이다"
}
2 changes: 1 addition & 1 deletion frontend/src/pages/ReviewDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const ReviewDetailPage = () => {
tags,
content,
favoriteCount,
} = reviewDetail.reviews;
} = reviewDetail;

const theme = useTheme();

Expand Down
18 changes: 9 additions & 9 deletions frontend/src/router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ const router = createBrowserRouter([
return { Component: MemberRecipePage };
},
},
{
path: `${PATH.REVIEW}/:reviewId`,
async lazy() {
const { ReviewDetailPage } = await import(
/* webpackChunkName: "ReviewDetailPage" */ '@/pages/ReviewDetailPage'
);
return { Component: ReviewDetailPage };
},
},
],
},
{
Expand All @@ -78,6 +69,15 @@ const router = createBrowserRouter([
return { Component: HomePage };
},
},
{
path: `${PATH.REVIEW}/:reviewId`,
async lazy() {
const { ReviewDetailPage } = await import(
/* webpackChunkName: "ReviewDetailPage" */ '@/pages/ReviewDetailPage'
);
return { Component: ReviewDetailPage };
},
},
],
},
{
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/types/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ export interface MemberRecipeResponse {
page: Page;
recipes: MemberRecipe[];
}
export interface ReviewDetailResponse {
reviews: ReviewDetail;
}

export interface CommentResponse {
hasNext: boolean;
totalElements: number | null;
Expand Down

0 comments on commit 3f77bf1

Please sign in to comment.