Skip to content

Commit 33e2b90

Browse files
committed
feat: 새로고침 버튼 추가
1 parent e0fda35 commit 33e2b90

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/pages/CharacterPage.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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}/>

0 commit comments

Comments
 (0)