Guest User

Untitled

a guest
Feb 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. /// Get user's info form the database
  2. ///
  3. /// - Parameter completed: Completition Block
  4. func getInfo(completed: @escaping DownloadComplete){
  5. let token = self.getToken()
  6. print(self.getError())
  7. if(token != nil && token != ""){
  8. //Here is where I check credentials.
  9. self.checkCredentials(completed: {
  10.  
  11. let url = "(Base_URL)(myInfo)(self.getToken() ?? "")"
  12.  
  13. Alamofire.request(url, method: HTTPMethod.get).responseJSON { respone in
  14.  
  15. if let result = respone.result.value as? Dictionary<String, AnyObject>{
  16.  
  17. if let user = result["User"] as? Dictionary<String, AnyObject>{
  18. var Info = Alumno()
  19.  
  20. if let id = user["id"] as? Int64!{
  21. Info.id = id
  22. }
  23.  
  24. ...
  25.  
  26. self.userInfo = Info
  27. completed()
  28. }
  29.  
  30. }
  31. }
  32.  
  33. })
  34. }
  35. }
  36.  
  37. {
  38. "Status": "Success"
  39. }
Add Comment
Please, Sign In to add comment