redux-axios-api-middleware
v0.5.0
Published
redux middleware using axios making api calls with redux easy
Downloads
14
Readme
redux-axios-api-middleware
schema
// simple schema transform
let schema: {
id: '_id',
name: 'users'
}
let apiResponse: {
_id: 1,
firstName: 'tina'
}
let output: {
entities: {
'1': { _id: 1, firstName: 'tina' }
},
result: [1]
}
// schema transform on response object
let schema: {
key: 'entities',
id: '_id',
name: 'users'
}
let apiResponse: {
entities: [
{
_id: 1,
firstName: 'tina'
}
]
}
let output: {
entities: {
'1': { _id: 1, firstName: 'tina' }
},
result: [1]
}
// schema transform with entity transform
let schema: {
key: 'entities',
id: '_id',
name: 'users',
entityTransform: entity => entity.person
}
let apiResponse: {
entities: [
{
person: {
_id: 1,
firstName: 'tina'
},
otherProperty: {}
}
]
}
let result: {
entities: {
'1': { _id: 1, firstName: 'tina' }
},
result: [1]
}