Skip to content

Instantly share code, notes, and snippets.

@indigoviolet
Created October 4, 2017 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indigoviolet/0bb9f72cfa3f4126dea4b6aefd65df0a to your computer and use it in GitHub Desktop.
Save indigoviolet/0bb9f72cfa3f4126dea4b6aefd65df0a to your computer and use it in GitHub Desktop.
fin blog embed
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