File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ const StudentRecord = () => {
2222 fatherContact : "" ,
2323 motherContact : "" ,
2424 } ) ;
25- const [ photo , setPhoto ] = useState < string | null > ( null ) ;
25+ const [ photo , setPhoto ] = useState < string > ( "" ) ;
2626
2727 useEffect ( ( ) => {
2828 const token = localStorage . getItem ( "accessToken" ) ;
@@ -50,7 +50,6 @@ const StudentRecord = () => {
5050 } ) ;
5151 setPhoto ( `${ process . env . NEXT_PUBLIC_BACKEND_DOMAIN } /images/${ data . image } ` ) ;
5252 } catch ( err ) {
53- alert ( `학생 정보 가져오기 실패 : ${ err } ` ) ;
5453 console . error ( "학생 정보 가져오기 실패 :" , err ) ;
5554 }
5655 } ;
@@ -63,7 +62,14 @@ const StudentRecord = () => {
6362 < div className = "flex flex-col sm:flex-row w-full gap-8 justify-start items-start" >
6463 { /* 증명 사진 */ }
6564 < div className = "flex justify-center items-center w-full sm:w-[272px] h-[336px] flex-shrink-0 border border-gray-400 cursor-default" >
66- { photo ? < img src = { photo } alt = "증명사진" className = "w-[250px] h-[250px] object-cover" /> : < p className = "text-base text-center text-gray-800" > 증명 사진</ p > }
65+ < img
66+ src = { photo }
67+ alt = "증명사진"
68+ className = "w-[250px] h-[250px] object-cover"
69+ onError = { ( e ) => {
70+ e . currentTarget . src = "/images/defaultImage.png" ;
71+ } }
72+ />
6773 </ div >
6874
6975 { /* 표 컨테이너 */ }
You can’t perform that action at this time.
0 commit comments