Exemplo n.º 1
0
        public async Task UnfollowUser(User user, HttpClient client)
        {
            if (!Logged)
            {
                return;
            }

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Token);

            if (Following.Any(e => e.Id == user.Id))
            {
                var response = await client.DeleteAsync($"api/users/{user.Id}/unfollow");

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    Following.Remove(user);
                    FollowingCount--;
                }
            }
        }