최종 발표까지 계속 개선, 보수 작업 중.
작성된 게시글 삭제 시에 한 번 더 확인 후 삭제 or 취소하는 동작을 추가했다.
async function DeleteCommunityDetail(community_id) {
if (confirm("게시글을 삭제하시겠습니까?") == true) {
alert("삭제되었습니다.");
loadDeleteCommunityDetail(community_id)
window.location.replace(`${frontend_base_url}/community.html`);
} else {
return false;
}
}
//api.js
async function loadDeleteCommunityDetail(community_id) {
const response = await fetch(`${backend_base_url}/posts/community/${community_id}/`, {
headers: {
"content-type": "application/json",
Authorization: "Bearer " + localStorage.getItem("access"),
},
method: "DELETE",
});
response_json = await response.json();
return response_json;
}