-
-
Save indigoviolet/0bb9f72cfa3f4126dea4b6aefd65df0a to your computer and use it in GitHub Desktop.
fin blog embed
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
import { createAsyncAction } from 'helpers/async'; | |
// I'm using the fetch api here, but you can substitute any http request libarary. | |
// For more about the fetch api: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | |
function latestPostsRequest() { | |
return fetch(`https://www.reddit.com/latest.json`) | |
.then( | |
response => response.json(), | |
error => console.log('An error occured.', error) | |
) | |
} | |
const FETCH_LATEST_POSTS = 'Actions/Posts/FetchLatest'; | |
export const fetchLatestPosts = createAsyncAction(FETCH_LATEST_POSTS, latestPostsRequest); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment