Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helpers option #16

Merged
merged 1 commit into from Oct 1, 2015
Merged

Add helpers option #16

merged 1 commit into from Oct 1, 2015

Conversation

lexich
Copy link
Owner

@lexich lexich commented Oct 1, 2015

Add: helpers options

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

lexich added a commit that referenced this pull request Oct 1, 2015
@lexich lexich merged commit e2bf2c0 into master Oct 1, 2015
@lexich lexich deleted the helpers branch October 1, 2015 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant