File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -30,10 +30,20 @@ const CharacterPage = () => {
3030 fetchCharacterData ( ) ;
3131 } , [ characterName ] ) ;
3232
33+ const handleUpdate = async ( name ) => {
34+ try {
35+ await axios . patch ( `${ import . meta. env . VITE_DEFAULT_API_URI } /v1/character/update?name=${ name } ` ) ;
36+ window . location . reload ( ) ;
37+ } catch ( error ) {
38+ console . error ( 'Error updating character:' , error ) ;
39+ }
40+ } ;
41+
3342 return (
3443 < div className = { styles . characterContainer } >
3544 { character ? (
3645 < >
46+ < button onClick = { ( ) => handleUpdate ( character . name ) } style = { { position : 'absolute' , right : '4%' , padding : '5px 10px' } } > 새로고침</ button >
3747 < div className = { styles . characterTopRow } >
3848 < div className = { styles . characterDetails } >
3949 < img src = { character . characterImage } alt = "캐릭터 이미지" className = { styles . characterImage } />
You can’t perform that action at this time.
0 commit comments