Forked from ivangodfather/gist:9f3ad527198ee513308e
Last active
September 15, 2015 07:48
-
-
Save Gurpartap/ed302142f9afcac6ff49 to your computer and use it in GitHub Desktop.
For @Godfather_ on IRC
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
request(.GET, CUSTOMER_URL, parameters: params, encoding: .URL).responseJSON { (request, response, result) -> Void in | |
if let message = JSON(result.value ?? "")["message"].string ?? "Default value to make it nonOptional" { | |
switch(result) { | |
case .Success(let json): | |
if let customer = JSON(json)["customer"].dictionaryObject { | |
GlobalCache.sharedInstance.setCustomer(customer) | |
} | |
completion(succeed: response?.statusCode == 200, message: message) | |
case .Failure(_,_): | |
completion(succeed: false, message: message) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment