{"id":18336325,"url":"https://github.com/launchpadlab/lp-redux-api","last_synced_at":"2025-10-14T02:05:51.012Z","repository":{"id":17228003,"uuid":"81397495","full_name":"LaunchPadLab/lp-redux-api","owner":"LaunchPadLab","description":"Api middleware for redux","archived":false,"fork":false,"pushed_at":"2025-03-13T08:06:21.000Z","size":670,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-04-09T19:55:15.589Z","etag":null,"topics":[],"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/LaunchPadLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-09T02:04:14.000Z","updated_at":"2023-06-29T19:00:31.000Z","dependencies_parsed_at":"2024-06-21T16:52:04.677Z","dependency_job_id":null,"html_url":"https://github.com/LaunchPadLab/lp-redux-api","commit_stats":{"total_commits":221,"total_committers":8,"mean_commits":27.625,"dds":0.3891402714932126,"last_synced_commit":"d6727339a8c292ced5ce0b9afde9eea99a16c61a"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaunchPadLab%2Flp-redux-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaunchPadLab%2Flp-redux-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaunchPadLab%2Flp-redux-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaunchPadLab%2Flp-redux-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LaunchPadLab","download_url":"https://codeload.github.com/LaunchPadLab/lp-redux-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103911,"owners_count":21048245,"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":[],"created_at":"2024-11-05T20:07:29.416Z","updated_at":"2025-10-14T02:05:45.977Z","avatar_url":"https://github.com/LaunchPadLab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/%40launchpadlab%2Flp-redux-api.svg)](https://badge.fury.io/js/%40launchpadlab%2Flp-redux-api)\n\n# lp-redux-api\n\nAction creators and reducers for making API requests with redux.\n\n```jsx\n// Define an API action\n\nimport { createRequest } from '@launchpadlab/lp-redux-api'\n\nconst fetchUser = createRequest('FETCH_USER', (id) =\u003e ({\n  url: '/users/' + id,\n}))\n\n// Dispatch the action from a component (mapDispatchToProps not shown)\n\nfunction Component({ fetchUser }) {\n  return \u003cbutton onClick={() =\u003e fetchUser(5)}\u003e Fetch user with id: 5 \u003c/button\u003e\n}\n\n// Store the response in a reducer\n\nimport { handleActions } from 'redux-actions'\nimport { setOnSuccess } from '@launchpadlab/lp-redux-api'\n\nconst reducer = handleActions(\n  {\n    [fetchUser]: setOnSuccess('user'),\n  },\n  {}\n)\n\n// state.user will contain the response when the request completes.\n```\n\nThe key functions in this library are:\n\n- `createRequest(key, requestInfo)` - this function allows you to define a redux action that makes an API request asynchronously. By default, API requests are made using [lp-requests](https://github.com/LaunchPadLab/lp-requests), although this is configurable.\n\n- `setOnSuccess(path) | setOnFailure(path)` - these functions allow you to easily store the responses of API actions in your redux store.\n\nAdditional usage information, as well as a list of other helpers this library provides, can be found in the [documentation](#documentation).\n\n## Documentation\n\nDocumentation and usage info can be found in [docs.md](docs.md).\n\n## Migration Guides\n\n- [v5.0.0](migration-guides/v5.0.0.md)\n- [v6.0.0](migration-guides/v6.0.0.md)\n- [v7.0.0](migration-guides/v7.0.0.md)\n\n## Contribution\n\nThis package follows the Opex [NPM package guidelines](https://github.com/LaunchPadLab/opex/blob/master/gists/npm-package-guidelines.md). Please refer to the linked document for information on contributing, testing and versioning.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaunchpadlab%2Flp-redux-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaunchpadlab%2Flp-redux-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaunchpadlab%2Flp-redux-api/lists"}