 
     public let company: String
     private let auth: HTTPBasicAuth
+
+    private let sessionManager: SessionManager
 
     public init(company: String, auth: HTTPBasicAuth) {
         self.company = company
         self.auth = auth
+
+        let configuration = URLSessionConfiguration.default
+        let authorizationHeader = DataRequest.authorizationHeader(
+            user: auth.username,
+            password: auth.password
+        )!
+
+        configuration.httpAdditionalHeaders = [
+            "Accept": "application/json",
+            authorizationHeader.key: authorizationHeader.value,
+        ]
+
+        self.sessionManager = SessionManager(configuration: configuration)
     }
 
     public func user(handler: @escaping APIType.UserHandler) {
         let request = Router.whoami.request(forCompany: company)
-        self.request(request, with: auth)
-            .responseJSON { json in
+        self.request(request)
+            .responseJSON { response in
+                guard let json = response.result.value else {
+                    handler(.failure(.networkFailed(response.result.error!)))
+
+                    return
+                }
+
                 let decoded: Decoded<Model.User> = decode(json)
 
                 switch decoded {

import Foundation

import func Alamofire.request
import enum Alamofire.HTTPMethod
import class Alamofire.DataRequest
import enum Result.Result

import Argo


    public func addEntry(for: (Model.Project, Model.Task), at date: Date) {
        let request = Router.addEntry.request(forCompany: company)
        self.request(request)
    }

    private func request(_ request: URLRequest) -> DataRequest {
        let request = sessionManager.request(request)
        return request
    }
}

