
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
redux-normalize-axios-middleware
Advanced tools
Normalize data using redux-axios-middleware and normalizr schema
Normalize data using redux-axios-middleware and normalizr schema
yarn add redux-normalize-axios-middleware normalizr
Add normalizeAxiosMiddleware
import normalizeAxiosMiddleware from 'redux-normalize-axios-middleware'
const store = createStore(testReducer, applyMiddleware(
axiosMiddleware(axiosClient),
normalizeAxiosMiddleware
))
Add normalizr schema to your action:
import { schema } from 'normalizr'
const fetchPosts = () => ({
type: 'FETCH_POSTS',
payload: {
request: {
url: API_URL
}
},
normalize: {
schema: new schema.Entity('posts'),
}
})
This will normalize data and include ids of items:
{
data: {
posts: {
items: { 1: { id: 1, title: 'title' } },
allIds: [1],
}
},
...remainingAxiosData
}
If your data is nested you can use path
option to specify what should be normalized. The remaining part of data outside of path
will be omitted. path
uses lodash/get format:
import { schema } from 'normalizr'
const fetchPosts = () => ({
type: 'FETCH_POSTS',
payload: {
request: {
url: API_URL
}
},
normalize: {
schema: [new schema.Entity('posts')],
path: 'allPosts'
}
})
This will normalize:
{
allPosts: [{
id: 1,
title: 'title'
}],
someOtherData: 'lorem ipsum',
}
To:
{
posts: {
items: { 1: { id: 1, title: 'title' } },
allIds: [1],
}
}
FAQs
Normalize data using redux-axios-middleware and normalizr schema
The npm package redux-normalize-axios-middleware receives a total of 1 weekly downloads. As such, redux-normalize-axios-middleware popularity was classified as not popular.
We found that redux-normalize-axios-middleware 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
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.