diff --git a/frontend/src/components/pages/travelogueRegister/TravelogueRegisterPage.tsx b/frontend/src/components/pages/travelogueRegister/TravelogueRegisterPage.tsx index e39785d6..1b161ebc 100644 --- a/frontend/src/components/pages/travelogueRegister/TravelogueRegisterPage.tsx +++ b/frontend/src/components/pages/travelogueRegister/TravelogueRegisterPage.tsx @@ -73,8 +73,14 @@ const TravelogueRegisterPage = () => { const { mutateAsync: handleAddImage } = usePostUploadImages(); const handleChangeThumbnail = async (e: React.ChangeEvent) => { - const thumbnail = await handleAddImage(Array.from(e.target.files as FileList)); - setThumbnail(thumbnail[0]); + try { + const thumbnail = await handleAddImage(Array.from(e.target.files as FileList)); + setThumbnail(thumbnail[0]); + } catch (error) { + if (error instanceof Error) { + alert(error.message); + } + } }; const [isOpen, setIsOpen] = useState(false); diff --git a/frontend/src/queries/usePostUploadImages.ts b/frontend/src/queries/usePostUploadImages.ts index 764a77b6..a7c945f4 100644 --- a/frontend/src/queries/usePostUploadImages.ts +++ b/frontend/src/queries/usePostUploadImages.ts @@ -26,8 +26,5 @@ export const usePostUploadImages = () => { return response.data; }, - onError: (error) => { - alert(error.message); - }, }); };