{"action":"created","issue":{"url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/854","repository_url":"https://api.github.com/repos/davezuko/react-redux-starter-kit","labels_url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/854/labels{/name}","comments_url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/854/comments","events_url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/854/events","html_url":"https://github.com/davezuko/react-redux-starter-kit/issues/854","id":159667041,"number":854,"title":"api example","user":{"login":"kodermax","id":590985,"avatar_url":"https://avatars.githubusercontent.com/u/590985?v=3","gravatar_id":"","url":"https://api.github.com/users/kodermax","html_url":"https://github.com/kodermax","followers_url":"https://api.github.com/users/kodermax/followers","following_url":"https://api.github.com/users/kodermax/following{/other_user}","gists_url":"https://api.github.com/users/kodermax/gists{/gist_id}","starred_url":"https://api.github.com/users/kodermax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kodermax/subscriptions","organizations_url":"https://api.github.com/users/kodermax/orgs","repos_url":"https://api.github.com/users/kodermax/repos","events_url":"https://api.github.com/users/kodermax/events{/privacy}","received_events_url":"https://api.github.com/users/kodermax/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-10T15:57:39Z","updated_at":"2016-06-10T22:04:51Z","closed_at":null,"body":"could you please add example for api"},"comment":{"url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/comments/225307303","html_url":"https://github.com/davezuko/react-redux-starter-kit/issues/854#issuecomment-225307303","issue_url":"https://api.github.com/repos/davezuko/react-redux-starter-kit/issues/854","id":225307303,"user":{"login":"kolpav","id":19467143,"avatar_url":"https://avatars.githubusercontent.com/u/19467143?v=3","gravatar_id":"","url":"https://api.github.com/users/kolpav","html_url":"https://github.com/kolpav","followers_url":"https://api.github.com/users/kolpav/followers","following_url":"https://api.github.com/users/kolpav/following{/other_user}","gists_url":"https://api.github.com/users/kolpav/gists{/gist_id}","starred_url":"https://api.github.com/users/kolpav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kolpav/subscriptions","organizations_url":"https://api.github.com/users/kolpav/orgs","repos_url":"https://api.github.com/users/kolpav/repos","events_url":"https://api.github.com/users/kolpav/events{/privacy}","received_events_url":"https://api.github.com/users/kolpav/received_events","type":"User","site_admin":false},"created_at":"2016-06-10T22:04:51Z","updated_at":"2016-06-10T22:04:51Z","body":"Copied from http://redux.js.org/docs/advanced/AsyncActions.html\r\nOr you can try https://github.com/agraboso/redux-api-middleware\r\n```javascript\r\nimport fetch from 'isomorphic-fetch'\r\n\r\nexport const REQUEST_POSTS = 'REQUEST_POSTS'\r\nfunction requestPosts(subreddit) {\r\n  return {\r\n    type: REQUEST_POSTS,\r\n    subreddit\r\n  }\r\n}\r\n\r\nexport const RECEIVE_POSTS = 'RECEIVE_POSTS'\r\nfunction receivePosts(subreddit, json) {\r\n  return {\r\n    type: RECEIVE_POSTS,\r\n    subreddit,\r\n    posts: json.data.children.map(child => child.data),\r\n    receivedAt: Date.now()\r\n  }\r\n}\r\n\r\nexport function fetchPosts(subreddit) {\r\n  return function (dispatch) {\r\n    dispatch(requestPosts(subreddit))\r\n    return fetch(`http://www.reddit.com/r/${subreddit}.json`)\r\n      .then(response => response.json())\r\n      .then(json =>\r\n        dispatch(receivePosts(subreddit, json))\r\n      )\r\n  }\r\n}\r\n```"}}
{"actor":{"display_login":"kolpav"}}