Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] fix: 리뷰 상세 api 수정 #796

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading