Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//
// AuthenticationDataHandler.swift
// Bonfire
//
// Created by Charles Muchene on 2/10/20.
// Copyright © 2020 SenseiDevs. All rights reserved.
//
import Alamofire
import Foundation
class AuthenticationDataHandler {
/// Login user with given `Login` instance
/// - Parameters:
/// - login: `Login` instance
/// - completionHandler: Handler to receive result
func login(with login: Login, completionHandler: @escaping (Result<Token, APIError>) -> Void) {
Network.shared.session
.request(UserRouter.login(login))
.validate(statusCode: .ok .+ .invalidCredentials)
.responseDecodable(of: Token.self, errorCode: .invalidCredentials, completionHandler: completionHandler)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.