Last active
September 2, 2016 17:36
-
-
Save ties/217dd6e87b0d97e95c4597739ab16d5a 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
| // with Babel do-expression-transform <https://babeljs.io/docs/plugins/transform-do-expressions/> | |
| function(lhs, rhs) { | |
| return do { | |
| if (lhs) { | |
| Api.fromJS(lhs) | |
| } else { | |
| res.firstField = do { | |
| if (rhs) { | |
| List(rhs.map((vt) => SomeClass.fromJS(vt))) | |
| } else { | |
| List() | |
| } | |
| } | |
| } | |
| } |
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
| // ... | |
| /** | |
| * Perform the request by first setting up all the needed options and finally | |
| * returning the promise. | |
| */ | |
| async doRequest(preparedRequest) { | |
| winston.debug(`${preparedRequest.method} ${preparedRequest.url}`) | |
| const response = await this.axios.request(preparedRequest) | |
| if (response.status !== 200) { | |
| throw new Error(`Http request not succesfull (status ${response.status})`, response) | |
| } | |
| return response.data | |
| } | |
| // ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment