Skip to content

Commit

Permalink
fix: 누락된 수정사항 push
Browse files Browse the repository at this point in the history
(feat: 댓글 등록 후 alert창 출력, 새로고침 하도록 구현)
  • Loading branch information
pandahwang committed Sep 30, 2024
1 parent 7b4e138 commit bef596f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pages/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,13 @@ useEffect(() => {

function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
postData(`/comment/${id}`, formData).then(() => {
setFormData({ userID: id || "", nickname: "", content: "", password: "" });
postData(`/comment/${id}`, formData).then(()=>{
window.alert("댓글이 등록되었습니다.");
}).catch((error) => {
window.alert("댓글 등록을 실패했습니다.");
console.error("Error posting data:", error);
}).finally(() => {
window.location.reload();
});
}

Expand Down

0 comments on commit bef596f

Please sign in to comment.