
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
api-calls-store
Advanced tools
API Calls store for react redux
npm install --save api-calls-store
In the reducers.js
file:
import APIReducer from "api-calls-store/src/store/api/reducer";
export default combineReducers({
// ...
APIReducer,
});
In the sagas.js
file:
import { apiSaga, initializeAPIStore } from "api-calls-store/src/package-index";
const clockCount = 15;
initializeAPIStore({
getAPI,
clockCount, // clockCount is the amount of times an API_CALL will be skipped - default is 10
});
export default function* rootSaga() {
yield all([
// ...
fork(apiSaga),
]);
}
In the App.js
add this useEffect
to dispatch the clock every Xms.
This clock will dispatch an action in the saga every Xms and that action will call the API.
useEffect(() => {
const interval = setInterval(() => {
dispatch({ type: "API_DISPATCH_CLOCK" });
}, 1000);
return () => clearInterval(interval);
}, [dispatch]);
/**
* {type: API_CALL, apiName: "apy", args: [], method: method || "GET" }
*/
export const API_CALL = "API_CALL";
/**
* {type: API_CALL_SUCCESS, call_key: "0x...", value: 221, code: 200, timestamp: new Date().getTime() }
*/
export const API_CALL_SUCCESS = "API_CALL_SUCCESS";
/**
* {type: API_CALL_FAIL, call_key: "0x...", value: 221, code: 200, timestamp: new Date().getTime() }
*/
export const API_CALL_FAIL = "API_CALL_FAIL";
/**
* {type: API_ADD_SUBSCRIPTION, key: "positions", componentApiCalls: [{ apiName: "apy", args: [etkAddress] }] }
*/
export const API_ADD_SUBSCRIPTION = "API_ADD_SUBSCRIPTION";
/**
* {type: API_REMOVE_SUBSCRIPTION, key: "positions" }
*/
export const API_REMOVE_SUBSCRIPTION = "API_REMOVE_SUBSCRIPTION";
/**
* API_DISPATCH_CLOCK -> This clock will dispatch an action in the saga every Xms and that action will call the API.
*/
export const API_DISPATCH_CLOCK = "API_DISPATCH_CLOCK";
/**
* API_SUBSCRIPTION_INCREASE_CLOCK -> This action sets when to call each subscription again
*/
export const API_SUBSCRIPTION_INCREASE_CLOCK = "API_SUBSCRIPTION_INCREASE_CLOCK";
/**
* API_INCREASE_CLOCK -> Increase the general clock to check if the saga should call the API again
*/
export const API_INCREASE_CLOCK = "API_INCREASE_CLOCK";
FAQs
API Calls Store for React Redux
We found that api-calls-store demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.