Created
August 30, 2015 09:32
-
-
Save vasarhelyia/7081add4dc34c4f0c4ad to your computer and use it in GitHub Desktop.
syncBrewAction
This file contains 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
syncBrewAction = Action { brewState in | |
if let jsonData:AnyObject = BrewState.encode(brewState).value { | |
let requestResult = self.requestWithBody("api/brew", method: "POST", body: JSON(jsonData)) | |
if let requestResultValue = requestResult.value { | |
return NSURLSession.sharedSession().rac_dataWithRequest(requestResultValue) | |
|> map { data, URLResponse in | |
return data | |
} | |
} | |
} | |
fatalError("jsonData is nil") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment