fix from addFavorite to search redirect
This commit is contained in:
parent
b4a3786b33
commit
a64bb9104e
@ -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";
|
||||
}
|
||||
|
@ -56,6 +56,8 @@
|
||||
<td>
|
||||
<form th:action="@{/api/1.0/addFavorite/{id}(id=${book.id})}" method="post">
|
||||
<input type="hidden" th:name="page" th:value="${page}">
|
||||
<input type="hidden" th:name="authorId" th:value="${authorId}">
|
||||
<input type="hidden" th:name="typeId" th:value="${typeId}">
|
||||
<button type="submit" class="btn btn-link button-link"
|
||||
th:hidden="${book.isChosen}">В избранное</button>
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user