diff --git a/src/constants/dummy.ts b/src/constants/dummy.ts index 60af621..3676cb6 100644 --- a/src/constants/dummy.ts +++ b/src/constants/dummy.ts @@ -179,6 +179,14 @@ export const MOCK_FLAVORS: IFlavor[] = [ id: 3, content: '쓴 맛이 나요', }, + { + id: 4, + content: '쓴 맛이 나요', + }, + { + id: 5, + content: '쓴 맛이 나요', + }, ]; export const MOCK_COUNTRY: ICountry = { diff --git a/src/pages/reviews/create/[beerId].page.tsx b/src/pages/reviews/create/[beerId].page.tsx index 3a7484b..6c1e3ff 100644 --- a/src/pages/reviews/create/[beerId].page.tsx +++ b/src/pages/reviews/create/[beerId].page.tsx @@ -22,8 +22,8 @@ const CreateReviewPage: NextPage = ({ beer, review }) =>
} /> - - + + @@ -42,18 +42,18 @@ export const getServerSideProps: GetServerSideProps = async (context) => { const { beerId, reviewId } = context.query; const id = reviewId || beerId; - if (id && typeof id === 'string' && Number(id)) { - if (reviewId) { - const review = await getReview(Number(id)); - const beer = await getBeer(review.beer.id); - - return { props: { beer, review } }; - } - - const beer = await getBeer(Number(id)); - - return { props: { beer } }; - } + // if (id && typeof id === 'string' && Number(id)) { + // if (reviewId) { + // const review = await getReview(Number(id)); + // const beer = await getBeer(review.beer.id); + // + // return { props: { beer, review } }; + // } + // + // const beer = await getBeer(Number(id)); + // + // return { props: { beer } }; + // } return { props: {} }; }; diff --git a/src/pages/reviews/create/components/ReviewDetailContainer/ReviewDetailContainer.tsx b/src/pages/reviews/create/components/ReviewDetailContainer/ReviewDetailContainer.tsx index 6b2484f..0be1d02 100644 --- a/src/pages/reviews/create/components/ReviewDetailContainer/ReviewDetailContainer.tsx +++ b/src/pages/reviews/create/components/ReviewDetailContainer/ReviewDetailContainer.tsx @@ -72,12 +72,12 @@ const ReviewDetailContainer: React.FC = ({ { ...reviewForm, ...data, - beerId: beer.id, + beerId: beer?.id, } as ICreateReviewPayload, { onSuccess: (_data) => router.push(`/record/ticket/${_data.id}?type=${NEW_TYPE}`) }, ); }, - [createReviewMutation, reviewForm, beer.id, router], + [createReviewMutation, reviewForm, beer?.id, router], ); // const handleUpdateSubmit = useCallback( @@ -111,7 +111,7 @@ const ReviewDetailContainer: React.FC = ({ >

{'당신만의 맥주 이야기도 들려주세요'}

-

{beer.korName}

+

{beer?.korName}

= ({ > 이번 맥주는 어땠나요? {beerName} - + diff --git a/src/pages/reviews/create/components/ReviewFlavorsContainer/ReviewFlavorsContainer.tsx b/src/pages/reviews/create/components/ReviewFlavorsContainer/ReviewFlavorsContainer.tsx index 9bd613d..d65c30a 100644 --- a/src/pages/reviews/create/components/ReviewFlavorsContainer/ReviewFlavorsContainer.tsx +++ b/src/pages/reviews/create/components/ReviewFlavorsContainer/ReviewFlavorsContainer.tsx @@ -12,6 +12,7 @@ import MultiSelectField from '@/components/formFields/MultiSelectField'; import FormSubmitButton from '@/components/FormSubmitButton'; import Icon from '@/components/Icon'; import { SwiperLayoutChildProps } from '@/components/layouts/SwiperLayout'; +import { MOCK_FLAVORS as flavors } from '@/constants/dummy'; import $reviewForm from '@/recoil/atoms/reviewForm'; import { IFeelStatus } from '@/types'; @@ -28,7 +29,8 @@ const ReviewFlavorsContainer: React.FC = ({ onMovePrev, onMoveNext, }) => { - const { data: flavors } = useGetFlavors(); + // @TODO: API 정상 호출되면 Mock data 제거 + // const { data: flavors } = useGetFlavors(); const [{ feelStatus }, setRecordForm] = useRecoilState($reviewForm); const flavorOptions = useMemo(