Gathering detailed insights and metrics for @abramstyle/redux-api
Gathering detailed insights and metrics for @abramstyle/redux-api
Gathering detailed insights and metrics for @abramstyle/redux-api
Gathering detailed insights and metrics for @abramstyle/redux-api
A redux middleware making api call, but with middlewares.
npm install @abramstyle/redux-api
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
3 Stars
42 Commits
1 Watchers
1 Branches
2 Contributors
Updated on Mar 08, 2023
Latest Version
0.2.4
Package Id
@abramstyle/redux-api@0.2.4
Unpacked Size
269.85 kB
Size
70.14 kB
File Count
20
NPM Version
6.4.1
Node Version
10.11.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
A redux middleware making api call, but with middlewares.
1yarn add @abramstyle/redux-api
1import {createStore, applyMiddleware } from 'redux'; 2import reduxApiGenerator from '@abramstyle/redux-api'; 3 4const reduxApi = reduxApiGenerator(); 5const middlewares = [reduxApi]; 6const store = createStore(reducers, applyMiddlewares(middlewares));
reduxApiGenerator(options = {})
it returns a reduxMiddleware
options.before
an function that will transform fetchOptions before request.
you can do some common things for every request.
options.middleware
define global middleware just like callAPI.middleware
options.isSuccess
define global success checker just like callAPI.isSuccess
options.success
define global success callback just like callAPI.success
options.failure
define global failure callback just like callAPI.failure
a api requesting action has [CALL_API] property. it specified request info.
1import {CALL_API} from '@abramstyle/redux-api'; 2const action = { 3 [CALL_API]: { 4 url: 'https://api.domain.com', 5 types: [ 6 'REQUEST_TYPE', 7 'SUCCESS_TYPE', 8 'FAILURE_TYPE' 9 ], 10 } 11};
callAPI.credentials
one of omit, same-origin, or include. must be a string.
callAPI.headers
must be an object. specified request headers.
callAPI.query
it will be append to url as query.
callAPI.data
data should be sent to server. if it is an get method, it will be append to url as query.
callAPI.method
request method, should be a valid method.
callAPI.isSuccess
check if a request is success.
the resultPayload will be passed into the function.
return true
or false
to identity if result is succeed.
NOTE: It will override global options.isSuccess
callAPI.success
this function will be called after request is success finished.
the result payload will be passed into the function.
NOTE: It will override global options.success
callAPI.failure
this function will be called after request is failure.
the result payload will be passed into the function.
NOTE: It will override global options.failure
an api request has these status: initial, requesting, success, failure.
redux-api will dispatch these actions.
once a call api action is dispatched, an promise is returned.
1{ 2 type: requestType, 3 payload: callAPI.data || {}, 4 meta: callAPI.meta || {} 5}
1{ 2 type: successType, 3 payload: parsedResponseData, 4 meta: callAPI.meta || {}, 5}
1{ 2 type: failureType, 3 payload: errorInstance, 4 meta: callAPI.meta, 5 error: true, 6}
NOTE: payload is an error instance. http status code will be found as error.status. the error message responded from server will be found as error.data. the full response will be find as error.response.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
107 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