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(
|
public String addFavorite(
|
||||||
@PathVariable(name = "id") Long id,
|
@PathVariable(name = "id") Long id,
|
||||||
@RequestParam(name = PAGE_ATTRIBUTE, defaultValue = "0") int page,
|
@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,
|
RedirectAttributes redirectAttributes,
|
||||||
@AuthenticationPrincipal UserPrincipal principal) {
|
@AuthenticationPrincipal UserPrincipal principal) {
|
||||||
redirectAttributes.addAttribute(PAGE_ATTRIBUTE, page);
|
redirectAttributes.addAttribute(PAGE_ATTRIBUTE, page);
|
||||||
|
redirectAttributes.addAttribute(TYPE_ATTRIBUTE, typeId);
|
||||||
|
redirectAttributes.addAttribute(AUTHOR_ATTRIBUTE, authorId);
|
||||||
userService.addFavorite(principal.getId(), id);
|
userService.addFavorite(principal.getId(), id);
|
||||||
return Constants.REDIRECT_VIEW + Constants.API_URL + "/search";
|
return Constants.REDIRECT_VIEW + Constants.API_URL + "/search";
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,8 @@
|
|||||||
<td>
|
<td>
|
||||||
<form th:action="@{/api/1.0/addFavorite/{id}(id=${book.id})}" method="post">
|
<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="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"
|
<button type="submit" class="btn btn-link button-link"
|
||||||
th:hidden="${book.isChosen}">В избранное</button>
|
th:hidden="${book.isChosen}">В избранное</button>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user