Skip to content

Commit

Permalink
fixed the deletion of veterinarians by omitting the responseresult of…
Browse files Browse the repository at this point in the history
… delete method. (Will hold for now :))
  • Loading branch information
FruTooTi committed Jan 3, 2024
1 parent 7309a01 commit 1f6bfbe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,18 @@ public ResponseEntity<VeterinarianDTO> deleteVeterinarian(@PathVariable Integer

@GetMapping("/delete/{id}")
public String getDeleteVeterinarian(@PathVariable Integer id, Model model) {
VeterinarianDTO deletedVeterinarian = veterinarianService.deleteVeterinarian(id);
List<VeterinarianDTO> veterinarians = veterinarianService.getAllVeterinarians();
model.addAttribute("veterinarians", veterinarians);
model.addAttribute("viewType", "default");
return "redirect:/api/veterinarians/desktop";
try{
VeterinarianDTO deletedVeterinarian = veterinarianService.deleteVeterinarian(id);
}
catch (Exception e){
System.out.println(e);
}
finally {
List<VeterinarianDTO> veterinarians = veterinarianService.getAllVeterinarians();
model.addAttribute("veterinarians", veterinarians);
model.addAttribute("viewType", "default");
return "redirect:/api/veterinarians/desktop";
}
}


Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/desktop.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<td th:text="${vet.user.name}"></td>
<td th:text="${vet.clinic}"></td>
<td>
<a th:href="@{'/delete/' + ${vet.user.userID}}" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete this veterinarian?')">Delete</a>
<a th:href="@{'/api/veterinarians/delete/' + ${vet.vetID}}" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete this veterinarian?')">Delete</a>
</td>

</tr>
Expand Down

0 comments on commit 1f6bfbe

Please sign in to comment.