Last active
July 15, 2018 00:29
-
-
Save FagnerMartinsBrack/23be7a49e9580d3ef7a0b4c1e06161f4 to your computer and use it in GitHub Desktop.
(Medium) - Decouple Side-Effects
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
const createListOfPosts_ = () => { | |
const PostsResponse = /* import */ PostsResponse_; | |
return fetch('/blog/posts').then((response) => { | |
return response | |
- .text(); | |
+ .json(); | |
}).then(( | |
- htmlResponse | |
+ jsonResponse | |
) => { | |
return PostsResponse( | |
- htmlResponse | |
+ jsonResponse | |
).toHtmlList(); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment