{"id":16349483,"url":"https://github.com/arojunior/redux-middleware-injector","last_synced_at":"2025-10-26T02:30:43.770Z","repository":{"id":57351028,"uuid":"88091726","full_name":"arojunior/redux-middleware-injector","owner":"arojunior","description":"Middleware injector for Redux","archived":false,"fork":false,"pushed_at":"2017-05-03T11:51:27.000Z","size":10,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T13:12:10.379Z","etag":null,"topics":["javascript","middleware","redux","redux-middleware-injector"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arojunior.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-12T20:06:32.000Z","updated_at":"2020-02-26T17:03:02.000Z","dependencies_parsed_at":"2022-09-18T23:03:18.220Z","dependency_job_id":null,"html_url":"https://github.com/arojunior/redux-middleware-injector","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/arojunior%2Fredux-middleware-injector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arojunior%2Fredux-middleware-injector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arojunior%2Fredux-middleware-injector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arojunior%2Fredux-middleware-injector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arojunior","download_url":"https://codeload.github.com/arojunior/redux-middleware-injector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238241470,"owners_count":19439768,"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":["javascript","middleware","redux","redux-middleware-injector"],"created_at":"2024-10-11T00:59:55.270Z","updated_at":"2025-10-26T02:30:36.463Z","avatar_url":"https://github.com/arojunior.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redux Middleware Injector\r\n\r\n[![npm version](https://img.shields.io/npm/v/redux-middleware-injector.svg)](https://www.npmjs.com/package/redux-middleware-injector) [![npm downloads](https://img.shields.io/npm/dm/redux-middleware-injector.svg)](https://www.npmjs.com/package/redux-middleware-injector) [![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\r\n\r\nThe recomended place to execute actions with side-effects in Redux is in the Middlewares.\r\nWith this lib you can write your own middleware wherever you want, for example in the action creators file.\r\nYou don't need to import all the middlewares with applyMiddleware before create the store.\r\n\r\nJust import the injector:\r\n\r\n```javascript\r\nimport injectMiddleware from \"redux-middleware-injector\"\r\n\r\nconst store = createStore(rootReducer, applyMiddleware(injectMiddleware))\r\n\r\n```\r\nAnd then you can write your own middlewares like the example below:\r\n\r\n```javascript\r\nexport const getUser = username =\u003e store =\u003e {\r\n  const {dispatch} = store\r\n\r\n  return next =\u003e action =\u003e {\r\n    dispatch({type: 'modules/Github/FETCHING'})\r\n\r\n    return axios.get(`https://api.github.com/users/${username}`).then(res =\u003e {\r\n      dispatch({\r\n        type: 'modules/Github/SUCCESS',\r\n        payload: {\r\n          data: res.data\r\n        }\r\n      })\r\n    })\r\n  }\r\n}\r\n```\r\n\r\nSee [Redux documentation](http://redux.js.org/docs/advanced/Middleware.html) about Middlewares\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farojunior%2Fredux-middleware-injector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farojunior%2Fredux-middleware-injector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farojunior%2Fredux-middleware-injector/lists"}