{"id":13492946,"url":"https://github.com/svagi/redux-routines","last_synced_at":"2025-03-28T11:31:07.758Z","repository":{"id":21473942,"uuid":"92844150","full_name":"svagi/redux-routines","owner":"svagi","description":"👷 Predefined actions creators and action types for common async tasks in a single object called \"routine\"","archived":false,"fork":false,"pushed_at":"2024-10-10T14:16:49.000Z","size":957,"stargazers_count":12,"open_issues_count":9,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-14T08:53:51.284Z","etag":null,"topics":["action-creator","boilerplate","redux","redux-actions","redux-boilerplate","redux-routines","routines","simple-api"],"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/svagi.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-30T14:54:16.000Z","updated_at":"2022-05-16T13:26:15.000Z","dependencies_parsed_at":"2023-12-13T22:44:41.626Z","dependency_job_id":"1edef497-81d2-4b1f-bff1-ae4e10bea755","html_url":"https://github.com/svagi/redux-routines","commit_stats":{"total_commits":99,"total_committers":6,"mean_commits":16.5,"dds":0.4949494949494949,"last_synced_commit":"a65341143619800a0823deb6d745f43df66492fd"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svagi%2Fredux-routines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svagi%2Fredux-routines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svagi%2Fredux-routines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svagi%2Fredux-routines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svagi","download_url":"https://codeload.github.com/svagi/redux-routines/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246020839,"owners_count":20710828,"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":["action-creator","boilerplate","redux","redux-actions","redux-boilerplate","redux-routines","routines","simple-api"],"created_at":"2024-07-31T19:01:10.698Z","updated_at":"2025-03-28T11:31:07.502Z","avatar_url":"https://github.com/svagi.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# redux-routines\n\nSimple, yet effective tool for removing Redux boilerplate code.\n\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n![](https://badgen.net/bundlephobia/min/redux-routines)\n![](https://badgen.net/bundlephobia/minzip/redux-routines)\n\n## About\n\nThe `redux-routines` is utility library for [redux](https://github.com/reactjs/redux) whose main goal is simplicity and boilerplate reduction.\n\n## Installation\n\n```sh\nnpm install --save redux-routines\n```\n\n## Features\n\n* Predefined actions creators and action types for common async tasks in a single object called \"routine\"\n* [FSA](https://github.com/acdlite/flux-standard-action) compatible – based on [redux-actions](https://github.com/reduxactions/redux-actions) library\n\n## The gist\n\n```js\nimport { createStore } from 'redux'\nimport { createRoutine } from 'redux-routines'\n\n// Create a new \"fetchUsers\" routine\nconst fetchUsers = createRoutine('FETCH_USERS')\n\n// Created action types\nfetchUsers.TRIGGER === 'FETCH_USERS_TRIGGER' // true\nfetchUsers.REQUEST === 'FETCH_USERS_REQUEST' // true\nfetchUsers.SUCCESS === 'FETCH_USERS_SUCCESS' // true\nfetchUsers.FAILURE === 'FETCH_USERS_FAILURE' // true\nfetchUsers.FULFILL === 'FETCH_USERS_FULFILL' // true\n\n// Available actions\nconst payload = {}\nfetchUsers.trigger(payload)\n// { type: 'FETCH_USERS_TRIGGER', payload: {} }\nfetchUsers.request(payload)\n// { type: 'FETCH_USERS_REQUEST', payload: {} };\nfetchUsers.success(payload)\n// { type: 'FETCH_USERS_SUCCESS', payload: {} };\nfetchUsers.failure(payload)\n// { type: 'FETCH_USERS_FAILURE', payload: {} };\nfetchUsers.fulfill(payload)\n// { type: 'FETCH_USERS_FULFILL', payload: {} };\n\n// Initial state of reducer\nconst initialState = {\n  isProcessing: false,\n  isFetching: false,\n  data: [],\n  error: null\n}\n\n// The reducer\nfunction users(state = initialState, action) {\n  switch (action.type) {\n    case fetchUsers.TRIGGER:\n      return { ...state, isProcessing: true }\n    case fetchUsers.REQUEST:\n      return { ...state, isFetching: true }\n    case fetchUsers.SUCCESS:\n      return { ...state, isFetching: false, data: action.payload }\n    case fetchUsers.FAILURE:\n      return { ...state, isFetching: false, error: action.payload }\n    case fetchUsers.FULFILL:\n      return { ...state, isProcessing: false }\n  }\n}\n\n// The store\nconst store = createStore(users)\nstore.subscribe(() =\u003e console.log(store.getState()))\n\n// Describe state changes with routine actions\nstore.dispatch(fetchUsers.trigger())\n// { isProcessing: true, isFetching: false, data: [], error: null }\nstore.dispatch(fetchUsers.request())\n// { isProcessing: true, isFetching: true, data: [], error: null }\nstore.dispatch(fetchUsers.success([1, 2]))\n// { isProcessing: true, isFetching: false, data: [ 1, 2 ], error: null }\nstore.dispatch(fetchUsers.fulfill())\n// { isProcessing: false, isFetching: false, data: [ 1, 2 ], error: null }\n```\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvagi%2Fredux-routines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvagi%2Fredux-routines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvagi%2Fredux-routines/lists"}