Created
September 15, 2015 07:36
-
-
Save ivangodfather/9f3ad527198ee513308e to your computer and use it in GitHub Desktop.
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 | |
var 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) //ERROR | |
case .Failure(_,_): | |
completion(succeed: false, message: message) //ERROR | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment