{"id":15448272,"url":"https://github.com/vasa-develop/redux-cross-fetch","last_synced_at":"2025-09-05T12:35:04.491Z","repository":{"id":57350471,"uuid":"177634973","full_name":"vasa-develop/redux-cross-fetch","owner":"vasa-develop","description":"A Redux middleware for API requests","archived":false,"fork":false,"pushed_at":"2019-04-08T19:29:33.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T13:29:41.317Z","etag":null,"topics":[],"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/vasa-develop.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":"2019-03-25T17:39:44.000Z","updated_at":"2019-04-08T19:29:35.000Z","dependencies_parsed_at":"2022-09-16T21:00:56.383Z","dependency_job_id":null,"html_url":"https://github.com/vasa-develop/redux-cross-fetch","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/vasa-develop%2Fredux-cross-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasa-develop%2Fredux-cross-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasa-develop%2Fredux-cross-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasa-develop%2Fredux-cross-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vasa-develop","download_url":"https://codeload.github.com/vasa-develop/redux-cross-fetch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246204678,"owners_count":20740361,"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-10-01T20:23:41.660Z","updated_at":"2025-03-29T15:31:09.576Z","avatar_url":"https://github.com/vasa-develop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"*Add `redux-cross-fetch` middleware to `createStore()`*\n\n## store.js\n\n```\nimport { createStore, applyMiddleware } from 'redux'\nimport rootReducer from '../reducers'\nimport apiMiddleWare from 'redux-cross-fetch'\n\nconst store = createStore(rootReducer, applyMiddleware(apiMiddleWare))\n\nexport default store\n```\n\n\nThe middleware takes following params:\n\n\n```\n        @param {url}: [REQUIRED] the request URL\n\n        @param {method}: [REQUIRED] HTTP method\n\n        @param {headers}: [OPTIONAL] headers sent with the HTTP request\n        \n        @param {body}: [OPTIONAL] body sent with the HTTP request\n        \n        @param {success}: [REQUIRED] action creator for successful response \n        Expects a payload for Server Response \n\n        @param {failure}: [REQUIRED] action creator for failed response\n        Expects a payload for Server Error\n```\n\n\n## actions.js\n\n\n*Create actions with `type` including the string `API_REQUEST` to fire the middleware.*\n\n\n```\nexport const testAction = () =\u003e ({\n    type: \"API_REQUEST\",\n    payload: {\n        request: {\n            url: \"https://api.github.com/users/vasa-develop\",\n            method: \"GET\"\n        },\n        success: apiSuccess,\n        failure: apiFailure\n    }\n})\n\nexport const apiSuccess = (response) =\u003e ({\n    type: \"API_SUCCESS\",\n    payload: {\n        response: response\n    }\n})\n\nexport const apiFailure = (error) =\u003e ({\n    type: \"API_FAILURE\",\n    payload: {\n        error: error\n    }\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasa-develop%2Fredux-cross-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvasa-develop%2Fredux-cross-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasa-develop%2Fredux-cross-fetch/lists"}