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

[Feature] - 썸네일 에러 발생 시 예외 처리 추가 #356

Merged
merged 2 commits into from
Aug 20, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@
const { mutateAsync: handleAddImage } = usePostUploadImages();

const handleChangeThumbnail = async (e: React.ChangeEvent<HTMLInputElement>) => {
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);
Expand Down Expand Up @@ -120,7 +126,7 @@
return () => {
saveTransformDetail(null);
};
}, [user?.accessToken, navigate]);

Check warning on line 129 in frontend/src/components/pages/travelogueRegister/TravelogueRegisterPage.tsx

View workflow job for this annotation

GitHub Actions / frontend-ci

React Hook useEffect has a missing dependency: 'saveTransformDetail'. Either include it or remove the dependency array

return (
<>
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/queries/usePostUploadImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ export const usePostUploadImages = () => {

return response.data;
},
onError: (error) => {
alert(error.message);
},
});
};
Loading