현재 삭제기능을 구현하였는데 삭제를 클릭하니까 신고글 전체가 삭제되고
새로고침하니까 (Entity must not be null) 가 떳다.
@PreAuthorize("isAuthenticated()")
@GetMapping("/report/delete/{id}")
public String reportDelete(@PathVariable("id") Integer id,Principal principal){
Report report = this.reportService.getReportList(id);
Member member = this.memberService.findByUsername(principal.getName());
if (member == null) {
// 작성자를 찾을 수 없는 경우에 대한 처리
return "redirect:/book/list"; // 예시로 홈 페이지로 리다이렉트
}
this.reportService.delete(report);
return "redirect: /report_list"; <----여기 리다이렉트가 문제이다.
}
return "redirect: /report/list"; 이렇게 해주니까 해결되었다.