File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
src/app/reviews/_components Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -87,12 +87,23 @@ const ReviewEditorModal = ({
8787 const handleFocusContent = ( ) => {
8888 setIsContentValid ( true )
8989 }
90- const handleImageUpload = ( e : React . ChangeEvent < HTMLInputElement > ) => {
90+ const handleImageUpload = async ( e : React . ChangeEvent < HTMLInputElement > ) => {
9191 const file = e . target . files ?. [ 0 ]
9292 if ( ! file ) return
93- setValue ( 'image' , file )
94- setValue ( 'imagePreview' , URL . createObjectURL ( file ) )
95- setValue ( 'isImageChanged' , true )
93+
94+ try {
95+ setValue ( 'image' , file )
96+ setValue ( 'imagePreview' , URL . createObjectURL ( file ) )
97+ setValue ( 'isImageChanged' , true )
98+ } catch ( error ) {
99+ console . error ( '이미지 업로드 중 오류 발생:' , error )
100+ toast ( {
101+ title : '이미지 업로드에 실패했어요.' ,
102+ description : '다시 시도해주세요.' ,
103+ variant : 'destructive' ,
104+ position : 'center' ,
105+ } )
106+ }
96107 }
97108
98109 const handleImageDelete = ( ) => {
@@ -233,6 +244,7 @@ const ReviewEditorModal = ({
233244 < input
234245 type = "file"
235246 accept = "image/*"
247+ capture = "environment"
236248 className = "hidden"
237249 onChange = { handleImageUpload }
238250 />
You can’t perform that action at this time.
0 commit comments