Skip to content

Commit

Permalink
Merge pull request #16 from lexich/helpers
Browse files Browse the repository at this point in the history
Add helpers option
  • Loading branch information
lexich committed Oct 1, 2015
2 parents 4a2c9d2 + 8c8754f commit e2bf2c0
Show file tree
Hide file tree
Showing 10 changed files with 395 additions and 233 deletions.
26 changes: 26 additions & 0 deletions README.md
Expand Up @@ -180,6 +180,32 @@ function (state, action) {
}
```

- @param **options.{endpoint}.helpers** - object
```js
{
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
});
```

#### reduxApi object
`reduxApi` initializer returns non initialized object. You need to call `init` for initilize it.
```js
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "redux-api",
"version": "0.6.3",
"version": "0.6.4",
"main": "dist/redux-api.min.js",
"dependencies": {}
}

0 comments on commit e2bf2c0

Please sign in to comment.