Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User {
- var userJSON: [String:AnyObject]?
- }
- let sharedUser = User()
- Alamofire.request(.GET, "https://gyminyapp.azurewebsites.net/api/User").authenticate(user: emailTextField.text!, password: passwordTextField.text!).responseJSON {
- json in
- let responseJSON = json.result.value as? [String: AnyObject]
- // print("JSON: (responseJSON)")
- if responseJSON!["message"] != nil {
- let errorMessage = responseJSON!["message"] as! String
- alert = UIAlertController(title: "Error", message: errorMessage, preferredStyle: .Alert)
- alert?.addAction(okButton)
- alert!.view.tintColor = BarItems.greenTintColor
- self.presentViewController(alert!, animated: true, completion: nil)
- } else {
- if responseJSON != nil {
- sharedUser.userJSON = responseJSON
- }
- self.performSegueWithIdentifier("tabSegue", sender: nil)
- }
- }
- // Return user to sign in screen
- self.dismissViewControllerAnimated(true, completion: nil)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement