Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
redux-toolbelt-saga
Advanced tools
A set of helper functions that extends 'redux-toolbelt' for usage with redux-saga
.
Read about redux-toolbelt
here
The tools are available in the redux-toolbelt-saga
npm package.
npm install --save redux-toolbelt redux-toolbelt-saga redux-saga
# or
yarn add redux-toolbelt redux-toolbelt-saga redux-saga
You may import the functions you'd like to use using one of the two methods:
import {makeAsyncActionCreator} from 'redux-toolbelt'
import {makeAsyncSaga} from 'redux-toolbelt-saga'
// or
import makeAsyncActionCreator from 'redux-toolbelt/lib/makeAsyncActionCreator'
import makeAsyncSaga from 'redux-toolbelt-saga/lib/makeAsyncSaga'
makeAsyncSaga()
Creates a saga that handles actions created using makeAsyncActionCreator
.
The first argument specifies the saga to dispatch when the function in the second argument is dispatched.
const fetchTodos = makeAsyncActionCreator('FETCH_TODOS')
// Returns promise
const fetchTodosFromServer = ({id, url}, debug = false) => {/*...*/}
const saga = makeAsyncSaga(fetchTodos, fetchTodosFromServer)
//...
dispatch(fetchTodos({id: 100, url: 'http://google.com'}))
By default, the payload of the action is what was passed to the function as it's argument.
You have two ways of changing it, using options
:
const options = {
// pass specific arguments
args: [{id, url}],
// OR
// map the action to arguments using a regular or a generator function
mapArgs: function* mapArgs(action){
const {todosId} = action.payload
const url = yield select(urlSelector)
return [{id: todosId, url}, true]
}
}
const saga = makeAsyncSaga(fetchTodos, fetchTodosFromServer, options)
FAQs
Saga helpers for redux-toolbelt
We found that redux-toolbelt-saga demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.