Created
February 24, 2016 05:57
-
-
Save mcgrue/3735c2f28419db6c00be 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
| /// not public, but I want to test it. | |
| export function fetchPosts(subreddit) { | |
| return (dispatch) => { | |
| dispatch(requestPosts(subreddit)); | |
| const url = `http://www.reddit.com/r/${subreddit}.json`; | |
| return fetch(url) | |
| .then((req) => { return req.json(); }) | |
| .then((json) => { dispatch(receivePosts(subreddit, json)); }); | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment