
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
fetchum-redux
Advanced tools
Redux Actions for Fetchum
npm i -S fetchum-redux
generateRequestgenerateRequest returns a fetchum generateRequest wrapped in a thunk action.
When then returned function is called it will trigger 2 actions.
First 'NEW_FETCH_REQUEST' then 'FETCH_REQUEST_SUCCESS' if successful and 'FETCH_REQUEST_FAILURE' if not.
Examples
This example assumes redux-thunk is being used
import { generateRequest } from 'fetchum-redux';
const getRandomUserReq = generateRequest({
method: 'GET',
external: true,
route: 'http://uifaces.com/api/v1/random',
});
const getRandomUser = () => {
dispatch(getRandomUserReq())
.then(res => console.log(res.data))
.catch(res => console.error(res));
};
If you dont want to use redux-thunk then use like so:
import { generateRequest } from 'fetchum-redux';
const getRandomUserReq = generateRequest({
method: 'GET',
external: true,
route: 'http://uifaces.com/api/v1/random',
});
const getRandomUser = () => {
getRandomUserReq()(dispatch)
.then(res => console.log(res.data))
.catch(res => console.error(res));
};
generateCRUDRequestsReturn exactly like generateCRUDRequests from Fetchum but uses fetchum-redux generateRequest and passes a modify type param.
fetchAll adds FETCH_ALL to the type eg: 'NEW_FETCH_ALL_FETCH_REQUEST' 'FETCH_ALL_FETCH_REQUEST_SUCCESS'fetchOne adds FETCH_ONEcreate adds CREATEupdate adds UPDATEdelete adds DELETEAll of fetchum's basic calls work as well like so:
import { apiRequests } from 'fetchum-redux';
const getUsersDirect = () => {
apiRequests.get('/v1/users')(dispatch)
.then((res) => { console.log('my users', res.data); })
.catch((res, err) => { console.warn(res); });
};
const getUsersDirectWithThunk = () => {
dispatch(apiRequests.get('/v1/users'))
.then((res) => { console.log('my users', res.data); })
.catch((res, err) => { console.warn(res); });
};
Each method also takes an extra parameter at the end to use to modify the action type names.
The name parameter replaces the word 'FETCH' in the action type like so:
generateRequest looks like generateRequest({}, 'TEST') and the action types will be:
First 'NEW_TEST_REQUEST' then 'TEST_REQUEST_SUCCESS' if successful and 'TEST_REQUEST_FAILURE' if not.
generateCRUDRequests keeps its individual additions noted above but still overrides the word 'FETCH'.
For example generateCRUDRequests('/users', 'id', true, 'USERS') for a fetchOne would trigger
first 'NEW_FETCH_ONE_USERS_REQUEST' then 'FETCH_ONE_USERS_REQUEST_SUCCESS' if successful and 'FETCH_ONE_USERS_REQUEST_FAILURE' if not.
FAQs
Redux actions for fetchum
The npm package fetchum-redux receives a total of 1 weekly downloads. As such, fetchum-redux popularity was classified as not popular.
We found that fetchum-redux demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.