Gathering detailed insights and metrics for redux-api-actions
Gathering detailed insights and metrics for redux-api-actions
Gathering detailed insights and metrics for redux-api-actions
Gathering detailed insights and metrics for redux-api-actions
react-boilerplate-redux-saga-hoc
Easy ways to handle api calls,redux,saga...etc
redux-json-api
A bunch of Redux actions, action creators and reducers to integrate with a JSON API
redux-actions-api-addon
Redux Actions add-on to support API Requests.
@domtwlee/redux-api-actions
Redux middleware for dispatching api actions
redux-api-middleware's helper to support create api action.
npm install redux-api-actions
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
2 Stars
23 Commits
1 Watchers
6 Branches
1 Contributors
Updated on Oct 11, 2018
Latest Version
0.0.18
Package Id
redux-api-actions@0.0.18
Unpacked Size
875.48 kB
Size
171.49 kB
File Count
15
NPM Version
6.4.1
Node Version
10.13.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Utilities for redux-api-middleware, redux-actions and react-redux.
redux-api-actions
is available on npm.
1npm install --save redux-api-actions
redux-api-middleware
connect
a React component to a Redux store.
If you have something looks like this:
1const namespace = 'count'; 2 3export const NAMESPACE = namespace.toUpperCase(); 4export const TYPE_COUNT = NAMESPACE; 5export const TYPE_COUNT_REQUEST = `${TYPE_COUNT}_REQUEST`; 6export const TYPE_COUNT_SUCCESS = `${TYPE_COUNT}_SUCCESS`; 7export const TYPE_COUNT_FAILURE = `${TYPE_COUNT}_FAILURE`; 8 9export const endpoint = 'http://www.example.com/api/counter'
1import { createActions, handleActions } from 'redux-actions'; 2import { TYPE_COUNT } from './constants'; 3 4const defaultState = { counter: 10 }; 5export const increment = createAction(TYPE_COUNT); 6 7export const reducer = handleActions({ 8 [TYPE_COUNT]: state => state.update('counter', v => v + 1), 9}, defaultState);
1import { handleActions } from 'redux-actions'; 2import { RSAA } from 'redux-api-middleware'; 3import { 4 endpoint, 5 TYPE_COUNT_REQUEST, 6 TYPE_COUNT_SUCCESS, 7 TYPE_COUNT_FAILURE, 8} from './constants'; 9 10export const incrementRemote = amount => ({ 11 [RSAA]: { 12 endpoint: `${endpoint}/${amount}`, 13 method: 'GET', 14 headers: { 'Content-Type': 'application/json' }, 15 credentials: 'same-origin', 16 types: [ 17 TYPE_COUNT_REQUEST, 18 TYPE_COUNT_SUCCESS, 19 TYPE_COUNT_FAILURE, 20 ], 21 }, 22}); 23 24export const reducer = handleActions({ 25 [TYPE_COUNT_SUCCESS]: (state, { payload: { amount } }) => state.update('counter', v => amount), 26});
1import { bindActionCreators } from 'redux'; 2import { connect } from 'react-redux'; 3import { NAMESPACE } from './constants'; 4 5const reduxActions = { increment, incrementRemote }; 6 7const mapStateToProps = store => ({ store: store[NAMESPACE] }); 8const mapDispatchToProps = dispatch => ({ actions: bindActionCreators(reduxActions, dispatch) }); 9export const Container = connect(mapStateToProps, mapDispatchToProps)(Root);
Then, you can merge them into this gist:
1import creator from 'redux-api-actions'; 2import { endpoint } from './constants'; 3 4const { Container, Reducer, NAMESPACE } = creator({ 5 namespace: 'count', 6 state: { counter: 0 }, 7 component: Root, 8 actions: { 9 increment: { 10 success: state => state.update('counter', v => v + 1), 11 }, 12 incrementRemote: { 13 endpoint, 14 before: amount => ({ endpoint: `${endpoint}/${amount}` }), 15 success: (state, { payload: { amount } }) => state.update('counter', v => amount), 16 } 17 }, 18});
Looks good, right?
Finally, merge your Reducer
into your redux
store as usual.
1import { createStore, combineReducers } from 'redux'; 2const store = createStore( 3 combineReducers({ ...Reducer }), 4 initialState, 5);
Hey, I'm no good at Writting. So, please help me do this. And please help me add the test case.
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
93 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More