You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
// // LoginService.swift // GMERemittance // // Created by gme_2 on 07/09/2018. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. //
import Foundation
class LoginService: LoginServiceType { // MARK: Properties // MARK: Initialization // MARK: Data management }
protocol LoginApiService: ApiServiceType { func accessCode( userId: String, password: String, firebaseToken: String, success: @escaping (User?) -> Void, failure: @escaping (Error) -> Void ) }
extension LoginApiService { func accessCode( userId: String, password: String, firebaseToken: String, success: @escaping (User?) -> Void, failure: @escaping (Error) -> Void ) { APIRouter .accesscode(username: userId, password: password, firebasToken: firebaseToken) .request( needsAuthorization: false, success: {(response: UserContainer ) in if (response.errorCode ?? "") == "1" { let error = NSError.init( domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""] ) failure(error) } else { let model = response.data success(model) } }, failure: {failure($0)} ) } }
|