diff --git a/app/src/main/java/com/example/citrusclient/viewmodels/BooksViewModel.java b/app/src/main/java/com/example/citrusclient/viewmodels/BooksViewModel.java index e96c043..4c309ba 100644 --- a/app/src/main/java/com/example/citrusclient/viewmodels/BooksViewModel.java +++ b/app/src/main/java/com/example/citrusclient/viewmodels/BooksViewModel.java @@ -192,6 +192,46 @@ }); } + private void registerFavoriteCount(String accountId, Integer bookId){ + Call call = booksRest.registerFavoriteCount(accountId, bookId); + + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful()){ + System.out.println("Success registerFavorited"); + } else { + System.out.println("response error"); + } + } + + @Override + public void onFailure(Call call, Throwable t) { + System.out.println("NetWorkError" + t); + } + }); + } + + private void unregisterFavoriteCount(String accountId, Integer bookId){ + Call call = booksRest.unregisterFavoriteCount(accountId, bookId); + + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful()){ + System.out.println("Success unresterFavorited"); + } else { + System.out.println("response error"); + } + } + + @Override + public void onFailure(Call call, Throwable t) { + System.out.println("NetWorkError" + t); + } + }); + } + private String parseStatusCode(Integer code) { switch (code) { case 404: