diff --git a/frontend/src/apis/endpoints.ts b/frontend/src/apis/endpoints.ts index 2fbf1d531..45d334ee7 100644 --- a/frontend/src/apis/endpoints.ts +++ b/frontend/src/apis/endpoints.ts @@ -1,6 +1,7 @@ const endPoint = { postingReview: `${process.env.API_BASE_URL}reviews`, - gettingDetailedReview: (reviewId: number) => `${process.env.API_BASE_URL}reviews/${reviewId}`, + gettingDetailedReview: (reviewId: number, memberId: number) => + `${process.env.API_BASE_URL}reviews/${reviewId}?memberId=${memberId}`, gettingInfoToWriteReview: (reviewerGroupId: number) => `/reviewer-groups/${reviewerGroupId}`, gettingKeyword: `${process.env.API_BASE_URL}keywords`, }; diff --git a/frontend/src/apis/review.ts b/frontend/src/apis/review.ts index 437f76fb3..49b873491 100644 --- a/frontend/src/apis/review.ts +++ b/frontend/src/apis/review.ts @@ -4,7 +4,7 @@ import { ReviewData, WritingReviewInfoData } from '@/types'; import endPoint from './endpoints'; export const getDataToWriteReviewApi = async (reviewerGroupId: number) => { - const response = await fetch(endPoint.gettingDataToWriteReview(reviewerGroupId), { + const response = await fetch(endPoint.gettingInfoToWriteReview(reviewerGroupId), { method: 'GET', }); @@ -34,8 +34,8 @@ export const postReviewApi = async ({ reviewData }: { reviewData: ReviewData }) }; // 상세리뷰 -export const getDetailedReviewApi = async ({ reviewId }: { reviewId: number }) => { - const response = await fetch(endPoint.gettingDetailedReview(reviewId), { +export const getDetailedReviewApi = async ({ reviewId, memberId }: { reviewId: number; memberId: number }) => { + const response = await fetch(endPoint.gettingDetailedReview(reviewId, memberId), { method: 'GET', headers: { 'Content-Type': 'application/json', diff --git a/frontend/src/components/layouts/Sidebar/index.tsx b/frontend/src/components/layouts/Sidebar/index.tsx index de745aeb0..deefbb4d1 100644 --- a/frontend/src/components/layouts/Sidebar/index.tsx +++ b/frontend/src/components/layouts/Sidebar/index.tsx @@ -10,7 +10,7 @@ const PATH = { myPage: '/user/mypage', reviewWriting: '/user/review-writing', allReview: '/user/all-review', - detailedReview: '/user/detailed-review/0', + detailedReview: '/user/detailed-review/0?memberId=1', reviewGroupManagement: '/user/review-group-management', }; diff --git a/frontend/src/mocks/handlers/review.ts b/frontend/src/mocks/handlers/review.ts index 6feb7b3d3..89d0cfa4c 100644 --- a/frontend/src/mocks/handlers/review.ts +++ b/frontend/src/mocks/handlers/review.ts @@ -5,7 +5,7 @@ import endPoint from '@/apis/endpoints'; import { DETAILED_REVIEW_MOCK_DATA } from '../mockData/detailedReviewMockData'; const getDetailedReview = () => - http.get(endPoint.gettingDetailedReview(0), async ({ request }) => { + http.get(endPoint.gettingDetailedReview(0, 1), async ({ request }) => { return HttpResponse.json(DETAILED_REVIEW_MOCK_DATA); }); diff --git a/frontend/src/mocks/mockData/detailedReviewMockData.ts b/frontend/src/mocks/mockData/detailedReviewMockData.ts index 19311520f..6aae872b9 100644 --- a/frontend/src/mocks/mockData/detailedReviewMockData.ts +++ b/frontend/src/mocks/mockData/detailedReviewMockData.ts @@ -24,11 +24,5 @@ export const DETAILED_REVIEW_MOCK_DATA: DetailReviewData = { { id: 567810, question: '[공개] 동료의 소프트 스킬의 성장을 위해 피드백을 남겨 주세요.', answer: ANSWER }, { id: 98761, question: '[비공개] 팀 동료로 근무한다면 같이 일 하고 싶은 개발자인가요?', answer: ANSWER }, ], - keywords: [ - { id: 1, detail: '친절해요' }, - { id: 12, detail: '친절합니다!' }, - { id: 11, detail: '친절해요요요요요' }, - { id: 14, detail: '친절해해해해해' }, - { id: 18, detail: '친절해요요용' }, - ], + keywords: ['친절해요', '친절합니다!', '친절해요요요요요', '친절해해해해해', '친절해요요용'], }; diff --git a/frontend/src/pages/DetailedReviewPage/components/KeywordSection/index.tsx b/frontend/src/pages/DetailedReviewPage/components/KeywordSection/index.tsx index b94b4de94..0ee031dae 100644 --- a/frontend/src/pages/DetailedReviewPage/components/KeywordSection/index.tsx +++ b/frontend/src/pages/DetailedReviewPage/components/KeywordSection/index.tsx @@ -1,11 +1,9 @@ -import { Keyword } from '@/types'; - import ReviewSectionHeader from '../ReviewSectionHeader'; import * as S from './styles'; interface KeywordSectionProps { - keywords: Keyword[]; + keywords: string[]; index: number; } const KEY_WORD_HEADER = '키워드'; @@ -15,8 +13,8 @@ const KeywordSection = ({ keywords, index }: KeywordSectionProps) => { - {keywords.map(({ id, detail }) => ( - {detail} + {keywords.map((keyword) => ( + {keyword} ))} diff --git a/frontend/src/pages/DetailedReviewPage/index.tsx b/frontend/src/pages/DetailedReviewPage/index.tsx index afc92cabf..826b32bcf 100644 --- a/frontend/src/pages/DetailedReviewPage/index.tsx +++ b/frontend/src/pages/DetailedReviewPage/index.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { useParams } from 'react-router'; +import { useLocation, useParams } from 'react-router'; import { ReviewComment } from '@/components'; import { DetailReviewData } from '@/types'; @@ -15,15 +15,19 @@ const COMMENT = 'VITE 쓰고 싶다.'; const DetailedReviewPage = () => { const { id: reviewId } = useParams(); - const [detailedReview, setDetailedReview] = useState(null); + const location = useLocation(); + const searchParams = new URLSearchParams(location.search); + const memberId = searchParams.get('memberId'); + + const [detailedReview, setDetailedReview] = useState(); const [isLoading, setIsLoading] = useState(false); - const [errorMessage, setErrorMessage] = useState(''); + const [errorMessage, setErrorMessage] = useState(''); const fetch = async () => { if (!reviewId) return; try { setIsLoading(true); - const result = await getDetailedReviewApi({ reviewId: Number(reviewId) }); + const result = await getDetailedReviewApi({ reviewId: Number(reviewId), memberId: Number(memberId) }); setDetailedReview(result); setErrorMessage(''); @@ -43,7 +47,7 @@ const DetailedReviewPage = () => { if (isLoading) return
Loading...
; if (errorMessage) return
Error: {errorMessage}
; - if (!detailedReview) return
Error: '상세보기 리뷰 데이터를 가져올 수 없어요.'
; + if (!detailedReview) return
Error: 상세보기 리뷰 데이터를 가져올 수 없어요.
; return ( diff --git a/frontend/src/types/review.ts b/frontend/src/types/review.ts index fc52eb147..834e943c8 100644 --- a/frontend/src/types/review.ts +++ b/frontend/src/types/review.ts @@ -25,7 +25,7 @@ export interface DetailReviewData { }; }; contents: DetailReviewContent[]; - keywords: Keyword[]; + keywords: string[]; } // api @@ -46,11 +46,6 @@ export interface Question { content: string; } -export interface Keyword { - id: number; - content: string; -} - export interface WritingReviewInfoData { reviewerGroup: { id: number;