Skip to content

Version 0.6.4

Compare
Choose a tag to compare
@lexich lexich released this 12 Nov 06:40
· 269 commits to master since this release

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
});