Releases: lexich/redux-api
Releases · lexich/redux-api
Version 0.9.10
- Update: default adapter
- Catch all uncatched promise errors
- add responseHandler
0.9.0: Merge pull request #60 from lexich/crud-option
Version 0.7.2
- Add postfetch option #31 https://github.com/lexich/redux-api#postfetch
- Add support common.js require style #31
Version 0.7.1
Version 0.7.0
- add rootUrl for init function https://github.com/lexich/redux-api#initadapter-isserver-rooturl)
- params in endpoint now merge.
const api = reduxApi({
test: {
url: "/test",
options: { headers: { "Content-type": "application/json" } }
}
}).init(....);
api.actions.test.request(null, { headers: { "token": "test-token" } });
Version 0.6.8
Validation is working in request method #20
// rest.js
import reduxApi from "redux-api";
export default reduxApi({
test: {
url: "/api/test"
options: {
method: "post",
headers: {
"Accept": "application/json",
"Content-type": "application/json"
}
},
virtual: true,
validation(data, cb) {
const err = !data ? "Invalid data" : null;
cb(err, data);
}
}
});
.....
import {actions} from "./rest"
actions.test.request().then(...)
Version 0.6.7
Add request
method for pure xhr request without redux workflow #18
import {actions} from "./rest";
actions.entries.request().then((data)=> {
// processing xhr responce
});
Version 0.6.6
Bug fixing 05bd438
Version 0.6.5
Add async helpers #17
{
logger: "/api/logger",
test: {
url: "/api/test/:name/:id",
helpers: {
// complicated async logic
async() {
const {dispatch} = this;
return (cb)=> {
dispatch(rest.actions.logger((err)=> {
const args = [{id: 1, name: "admin"}];
cb(err, args);
}));
};
}
}
}
}
Version 0.6.4
Add helpers option #16
{
test: {
url: "/api/test/:name/:id",
helpers: {
get(id, name) {
return [{id, name}], {}]
},
post(id, name, data) {
const {uuid} = this.getState().test;
const urlparams = {id, name};
const params = {body: {uuid, data}};
return [urlparams, params];
}
}
}
}
// using helpers
rest.actions.test.get(1, "admin");
// with callback
rest.actions.post(1, "admin", {msg: "Hello"}, (err)=> {
// end of action
});