Created
September 25, 2019 19:04
-
-
Save catalinaturlea/500ed98658b263dcc77ec4666b786be6 to your computer and use it in GitHub Desktop.
UserService-version1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserService { | |
static var loginURL = "https://my.app.com/login" | |
static var shared = UserService() | |
func login(email: String, password: String, completion: (Bool, Error?)) { | |
let params = ["email": email, "password": password] | |
Alamofire.shared.request(loginURL, method: .POST, parameters: params, encoding: .URLEncoding).responseJSON { (response) in | |
switch respose.status { | |
case .succeeded: | |
completion(true, nil) | |
case .error(let error): | |
completion(false, error) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment