diff --git a/app/src/main/java/com/example/citrusclient/viewmodels/FavoritesViewModel.java b/app/src/main/java/com/example/citrusclient/viewmodels/FavoritesViewModel.java index 48322d5..e183844 100644 --- a/app/src/main/java/com/example/citrusclient/viewmodels/FavoritesViewModel.java +++ b/app/src/main/java/com/example/citrusclient/viewmodels/FavoritesViewModel.java @@ -88,4 +88,38 @@ } }); } + + public void setFavorite(String accountId,Integer bookId,String otherAccountId,String token){ + Call call = favoritesRest.putFavorite(accountId, bookId, otherAccountId, token); + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if(response.isSuccessful()){ + System.out.println("success : putFavorite"); + }else System.out.println(response.code()); + } + + @Override + public void onFailure(Call call, Throwable t) { + System.out.println("NetworkError : putFavorite" + t); + } + }); + } + + public void deletefavorite(String accountId,Integer bookId,String otherAccountId,String token){ + Call call = favoritesRest.removeFavorite(accountId, bookId, otherAccountId, token); + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if(response.isSuccessful()){ + System.out.println("success : removeFavorite"); + }else System.out.println(response.code()); + } + + @Override + public void onFailure(Call call, Throwable t) { + System.out.println("NetworkError : removeFavorite" + t); + } + }); + } }