From a64bb9104e2e0a5013bd4a2286e902a70fc322e9 Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Thu, 13 Jun 2024 19:44:06 +0400 Subject: [PATCH] fix from addFavorite to search redirect --- .../com/ip/library/controllers/users/UserBookController.java | 4 ++++ .../library/src/main/resources/templates/book-search.html | 2 ++ 2 files changed, 6 insertions(+) diff --git a/SpringApp/library/src/main/java/com/ip/library/controllers/users/UserBookController.java b/SpringApp/library/src/main/java/com/ip/library/controllers/users/UserBookController.java index ab59dd4..8e362db 100644 --- a/SpringApp/library/src/main/java/com/ip/library/controllers/users/UserBookController.java +++ b/SpringApp/library/src/main/java/com/ip/library/controllers/users/UserBookController.java @@ -118,9 +118,13 @@ public class UserBookController { public String addFavorite( @PathVariable(name = "id") Long id, @RequestParam(name = PAGE_ATTRIBUTE, defaultValue = "0") int page, + @RequestParam(name = TYPE_ATTRIBUTE, defaultValue = "-1") Long typeId, + @RequestParam(name = AUTHOR_ATTRIBUTE, defaultValue = "-1") Long authorId, RedirectAttributes redirectAttributes, @AuthenticationPrincipal UserPrincipal principal) { redirectAttributes.addAttribute(PAGE_ATTRIBUTE, page); + redirectAttributes.addAttribute(TYPE_ATTRIBUTE, typeId); + redirectAttributes.addAttribute(AUTHOR_ATTRIBUTE, authorId); userService.addFavorite(principal.getId(), id); return Constants.REDIRECT_VIEW + Constants.API_URL + "/search"; } diff --git a/SpringApp/library/src/main/resources/templates/book-search.html b/SpringApp/library/src/main/resources/templates/book-search.html index 28f8241..f4abe71 100644 --- a/SpringApp/library/src/main/resources/templates/book-search.html +++ b/SpringApp/library/src/main/resources/templates/book-search.html @@ -56,6 +56,8 @@
+ +