{"id":16252887,"url":"https://github.com/oliverbenns/redux-ghost","last_synced_at":"2025-03-19T20:31:38.579Z","repository":{"id":57156569,"uuid":"78341854","full_name":"oliverbenns/redux-ghost","owner":"oliverbenns","description":"Redux reducer and actions to get posts, users and tags from a Ghost Blog Public Api (https://ghost.org)","archived":false,"fork":false,"pushed_at":"2018-09-17T20:59:46.000Z","size":25,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T14:16:54.654Z","etag":null,"topics":["applymiddleware","bindactioncreators","ghost","ghost-blog","mapdispatchtoprops","react","redux","redux-ghost"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oliverbenns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-08T12:38:36.000Z","updated_at":"2022-10-07T11:50:41.000Z","dependencies_parsed_at":"2022-08-30T03:20:38.042Z","dependency_job_id":null,"html_url":"https://github.com/oliverbenns/redux-ghost","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliverbenns%2Fredux-ghost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliverbenns%2Fredux-ghost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliverbenns%2Fredux-ghost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliverbenns%2Fredux-ghost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oliverbenns","download_url":"https://codeload.github.com/oliverbenns/redux-ghost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243738873,"owners_count":20340003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["applymiddleware","bindactioncreators","ghost","ghost-blog","mapdispatchtoprops","react","redux","redux-ghost"],"created_at":"2024-10-10T15:15:12.913Z","updated_at":"2025-03-19T20:31:35.182Z","avatar_url":"https://github.com/oliverbenns.png","language":"JavaScript","funding_links":[],"categories":["📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"readme":"# redux-ghost\n[![npm version](https://badge.fury.io/js/redux-ghost.svg)](https://badge.fury.io/js/redux-ghost)\n## Installation\n```npm install --save redux-ghost```\n\n## Getting Started\n\n### Step 1\nEnable your Ghost blog to expose a public api following [this tutorial](http://api.ghost.org/docs/ajax-calls-from-an-external-website). Make note of your `client_id`, `client_secret` and `host` (e.g. `http://localhost:2368`).\n\n### Step 2\nFor a quick test, follow the [example](https://github.com/oliverbenns/redux-ghost/tree/master/example), otherwise configure redux ghost with your credentials in `step 1` and give the Ghost reducer to redux. Ensure you also include the [thunk middleware](https://github.com/gaearon/redux-thunk).\n\n```\nimport { createStore, combineReducers, applyMiddleware } from 'redux';\nimport thunk from 'redux-thunk';\nimport ReduxGhost, { reducer as ghostReducer } from 'redux-ghost';\n\nReduxGhost.config({\n  host: '', // e.g. http://localhost:2368\n  clientId: '', // e.g. ghost-frontend\n  clientSecret: '', // e.g. 4837a41df11b\n});\n\nconst rootReducer = combineReducers({\n  blog: ghostReducer,\n});\n\nconst store = createStore(rootReducer, null, applyMiddleware(thunk));\n```\n\n### Step 3\nSet up your store as you normally would, and fire off those actions.\n```\nimport React from 'react';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { actions } from 'redux-ghost';\n\nconst App = ({ actions, blog }) =\u003e {\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={() =\u003e actions.getPosts()}\u003eLoad Posts\u003c/button\u003e\n      {blog.posts.data \u0026\u0026 blog.posts.data.map((post, index) =\u003e (\n        \u003cdiv key={index}\u003e\n          \u003ch2\u003e{post.title}\u003c/h2\u003e\n          \u003cp\u003ePublished on: {post.published_at}\u003c/p\u003e\n          \u003cp\u003eSlug: {post.slug}\u003c/p\u003e\n        \u003c/div\u003e\n      ))}\n    \u003c/div\u003e\n  );\n}\n\nconst mapStateToProps = ({ blog }) =\u003e ({\n  blog,\n});\n\nconst mapDispatchToProps = (dispatch) =\u003e ({\n  actions: bindActionCreators(actions, dispatch)\n});\n\nexport default connect(\n  mapStateToProps,\n  mapDispatchToProps,\n)(App);\n\n```\n\n## Actions\n\nCall your actions how you like, I prefer binding mine to props using [bindActionCreators](http://redux.js.org/docs/api/bindActionCreators.html).\n\nActions available:\n\n| Action        | Arguments                                                                     |\n| ------------- | ----------------------------------------------------------------------------- |\n| getPosts      | [options (object)](https://api.ghost.org/docs/posts)                          |\n| getPost       | id (string / integer), [options (object)](https://api.ghost.org/docs/postsid) |\n| getPostBySlug | slug (string), [options (object)](https://api.ghost.org/docs/postsslugslug)   |\n| getTags       | [options (object)](https://api.ghost.org/docs/tags)                           |\n| getTag        | id (string / integer), [options (object)](https://api.ghost.org/docs/tagsid)  |\n| getTagBySlug  | slug (string), [options (object)](https://api.ghost.org/docs/tagsslugslug)    |\n| getUsers      | [options (object)](https://api.ghost.org/docs/users)                          |\n| getUser       | id (string / integer), [options (object)](https://api.ghost.org/docs/usersid) |\n| getUserBySlug | slug (string), [options (object)](https://api.ghost.org/docs/usersslugslug)   |\n| reset         |                                                                               |\n\n## Development\n\n### Build\nRun `nvm use; redux-ghost; npm install; npm run build`. Any further file changes will require another `npm run build`.\n\n### Example\n`nvm use; npm link; cd example; npm link redux-ghost; npm install; npm start`.\n\nOpen [`http://localhost:3030/`](http://localhost:3030/).\n\nAny new builds will automatically refresh the example with updates.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliverbenns%2Fredux-ghost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foliverbenns%2Fredux-ghost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliverbenns%2Fredux-ghost/lists"}