diff --git a/next.config.ts b/next.config.ts index 352d1704..6d83df4e 100644 --- a/next.config.ts +++ b/next.config.ts @@ -35,6 +35,10 @@ const nextConfig: NextConfig = { port: '', pathname: '/**', }, + { + protocol: 'https', + hostname: 'picsum.photos', + }, ], domains: ['mogazoa-api.vercel.app', 'example.com'], }, diff --git a/src/actions/review/review.ts b/src/actions/review/review.ts index 2f4de495..09a88d8b 100644 --- a/src/actions/review/review.ts +++ b/src/actions/review/review.ts @@ -59,7 +59,7 @@ export const postReview = async ({ 'Content-Type': 'application/json', }, body: JSON.stringify(newReview), - cache: 'no-store', + cache: 'no-cache', }); revalidatePath(`/products/${productId}`); @@ -84,7 +84,7 @@ export const patchReview = async ({ rating, content, images, reviewId }: ReviewP 'Content-Type': 'application/json', }, body: JSON.stringify(newReview), - cache: 'no-store', + cache: 'no-cache', }); revalidateTag('reviews'); @@ -101,7 +101,7 @@ export const deleteReview = async (reviewId: number, productId: number) => { headers: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json', - cache: 'no-store', + cache: 'no-cache', }, }); diff --git a/src/app/_components/ProductPost/ProductForm.tsx b/src/app/_components/ProductPost/ProductForm.tsx index fe2cda88..14d828d5 100644 --- a/src/app/_components/ProductPost/ProductForm.tsx +++ b/src/app/_components/ProductPost/ProductForm.tsx @@ -1,7 +1,8 @@ 'use client'; +import { useState } from 'react'; + import { zodResolver } from '@hookform/resolvers/zod'; -import { useErrorBoundary } from 'react-error-boundary'; import { Controller, useForm } from 'react-hook-form'; import { patchProduct, postProduct } from '@/actions/productDetail'; @@ -16,7 +17,7 @@ import { productSchema } from '@/types/product/productSchema'; import { ProductDetail, ProductFormValue } from '@/types/product/productType'; const ProductForm = ({ product, mode }: { product: ProductDetail; mode: 'create' | 'edit' }) => { - const { showBoundary } = useErrorBoundary(); + const [isError, setIsError] = useState(false); const closeModal = useModalStore((state) => state.closeModal); const openModal = useModalStore((state) => state.openModal); @@ -24,7 +25,7 @@ const ProductForm = ({ product, mode }: { product: ProductDetail; mode: 'create' register, handleSubmit, control, - formState: { errors, isValid, isSubmitting, isDirty }, + formState: { errors, isValid, isLoading, isDirty }, } = useForm({ resolver: zodResolver(productSchema), mode: 'all', @@ -53,8 +54,8 @@ const ProductForm = ({ product, mode }: { product: ProductDetail; mode: 'create' await patchProduct({ productId: product.id, data }); } closeModal(); - } catch (err) { - showBoundary(err); + } catch { + setIsError(true); } }; @@ -72,11 +73,12 @@ const ProductForm = ({ product, mode }: { product: ProductDetail; mode: 'create' )} /> -
+
- {mode === 'create' ? '추가하기' : '수정하기'} + {isError ? '존재하는 영화 제목 입니다.' : mode === 'create' ? '추가하기' : '수정하기'} {mode === 'edit' && ( - ); -} diff --git a/src/components/common/dropdowns/SortDropdown.tsx b/src/components/common/dropdowns/SortDropdown.tsx index 586dbe49..3a6a30b5 100644 --- a/src/components/common/dropdowns/SortDropdown.tsx +++ b/src/components/common/dropdowns/SortDropdown.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useMemo } from 'react'; +import { useCallback, useMemo } from 'react'; import DropdownIcon from '@/assets/icon/Icon-dropdown.svg'; import DropupIcon from '@/assets/icon/Icon-dropup.svg'; @@ -26,7 +26,7 @@ const SortDropdown = ({ onChange?: (value: string) => void; // 프롭을 string으로 받는 함수 option?: string; }) => { - const getSortOption = () => { + const getSortOption = useCallback(() => { switch (variant) { case 'product': return SORT_OPTION_PRODUCTS; @@ -37,9 +37,9 @@ const SortDropdown = ({ default: return []; } - }; + }, [variant]); - const sortOptions = useMemo(() => getSortOption(), [variant, getSortOption]); + const sortOptions = useMemo(() => getSortOption(), [getSortOption]); const displayValue = sortOptions.find((op) => op.value === option)?.name || sortOptions?.[0]?.name; @@ -67,7 +67,7 @@ const SortDropdown = ({ {isOpen && (
diff --git a/src/components/common/gnb/buttons/LogoButton.tsx b/src/components/common/gnb/buttons/LogoButton.tsx index 506afbb3..38f83aa4 100644 --- a/src/components/common/gnb/buttons/LogoButton.tsx +++ b/src/components/common/gnb/buttons/LogoButton.tsx @@ -4,7 +4,7 @@ import Link from 'next/link'; const LogoButton = () => { return ( - Logo + Logo ); }; diff --git a/src/components/ui/Buttons.tsx b/src/components/ui/Buttons.tsx index a8b6629d..0c5e384e 100644 --- a/src/components/ui/Buttons.tsx +++ b/src/components/ui/Buttons.tsx @@ -32,7 +32,7 @@ const Button: React.FC = ({ break; case 'tertiary': variantStyle = - 'bg-black-1c1c22 text-gray-9fa6b2 border-gray-9fa6b2 disabled:border-black-353542 border-[1px] disabled:text-gray-6e6e82'; + 'text-gray-9fa6b2 border-gray-9fa6b2 disabled:border-black-353542 border-[1px] disabled:text-gray-6e6e82'; break; } @@ -44,7 +44,7 @@ const Button: React.FC = ({ onClick={onClick} disabled={disabled} > -
+
{children}
diff --git a/src/components/ui/FloatingButton.tsx b/src/components/ui/FloatingButton.tsx index 977b454f..8930d4fa 100644 --- a/src/components/ui/FloatingButton.tsx +++ b/src/components/ui/FloatingButton.tsx @@ -1,5 +1,4 @@ 'use client'; -import React from 'react'; import { useSession } from 'next-auth/react'; @@ -18,19 +17,21 @@ const FloatingButton = () => { if (!session) return null; return ( -
-
- 상품 추가하기 - +
+
+
+ 영화 추가하기 + +
+
-
); }; diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsx index 329daef1..b6713a8f 100644 --- a/src/components/ui/avatar.tsx +++ b/src/components/ui/avatar.tsx @@ -33,10 +33,7 @@ function AvatarFallback({ return ( ); diff --git a/src/components/ui/chips/ThumbChip.tsx b/src/components/ui/chips/ThumbChip.tsx index 25b16703..92108852 100644 --- a/src/components/ui/chips/ThumbChip.tsx +++ b/src/components/ui/chips/ThumbChip.tsx @@ -21,7 +21,7 @@ const ThumbChip = ({ initialCount, initialState, reviewId }: ThumbChipProps) => type='button' onClick={handleToggle} className={cn( - 'text-mogazoa-12px-400 xl:text-mogazoa-18px-400 border-black-353542 bg-black-252530 light:bg-white flex shrink-0 items-center justify-center gap-[5px] rounded-full border-[1px] px-[10px] py-[6px]', + 'text-mogazoa-12px-400 xl:text-mogazoa-18px-400 border-black-353542 bg-black-252530 flex shrink-0 items-center justify-center gap-[5px] rounded-full border-[1px] px-[10px] py-[6px]', isToggled ? 'text-gradient' : 'text-gray-9fa6b2', )} > diff --git a/src/components/ui/textarea.tsx b/src/components/ui/textarea.tsx index 87a16c70..525e01f1 100644 --- a/src/components/ui/textarea.tsx +++ b/src/components/ui/textarea.tsx @@ -10,6 +10,7 @@ function Textarea({ hasError, ...props }: TextareaProps) { return (