Пример #1
0
        public ServiceManager()
        {
            _authService = new AuthService();
            _httpClient  = new CustomHttpClient(_authService)
            {
                BaseAddress = new Uri(BaseApiUrl)
            };
            Func <string> getAccessToken = () => GetUserToken().Result;
            var           accessToken    = getAccessToken.Invoke();

            if (accessToken != null)
            {
                _httpClient.DefaultRequestHeaders.Authorization =
                    new AuthenticationHeaderValue("Bearer", accessToken);
            }
            _httpClient.DefaultRequestHeaders
            .Accept
            .Add(new MediaTypeWithQualityHeaderValue("application/json"));

            _loginService = new LoginService(_authService, _httpClient);
            _taskService  = new TaskService(_httpClient);
        }
Пример #2
0
 public TaskService(CustomHttpClient httpClient)
 {
     _httpClient = httpClient;
 }