Skip to content

Instantly share code, notes, and snippets.

Created February 12, 2020 19:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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) {
.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