Skip to content

Commit

Permalink
Merge pull request #7 from lexich/adapters+dyn-options
Browse files Browse the repository at this point in the history
Adapters+dyn options
  • Loading branch information
lexich committed Sep 9, 2015
2 parents 61452bf + 6e0f273 commit 40fda7a
Show file tree
Hide file tree
Showing 11 changed files with 247 additions and 178 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bower install redux-api --save
```js
import reduxApi, {transformers} from "redux-api";
```
#### reduxApi(options, fetch)
#### reduxApi(options, fetchAdapter)
- **options** - configuration rest-api endpoints
> *type*: Object
> *return*: {reducers, actions} - `reducers` have to as parameter to `createStore` (see example section). actions (see `actions` section)
Expand All @@ -49,6 +49,16 @@ import reduxApi, {transformers} from "redux-api";
options: {} //it's default value
}
}
// equivalent
{
entry: {
url: "/api/v1/entry",
transformer: transformers.object, //it's default value
options: function(url, params) { //it's default value
return {};
}
}
}
```
**url** - endpoint for rest api
> *type*: String
Expand Down Expand Up @@ -83,9 +93,14 @@ import reduxApi, {transformers} from "redux-api";
}
```

- **fetch** - rest backend. Redux-api recommends to use `fetch` API for rest [whatwg-fetch](https://www.npmjs.com/package/whatwg-fetch)
- **adaptersFetch** - adapter for rest backend using `fetch` API for rest [whatwg-fetch](https://www.npmjs.com/package/whatwg-fetch)
> *type*: Function
> *default*: null
> *example*:
```js
// available adapters
import adapterFetch from "redux-api/adapters/fetch";
```

#### actions
```js
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-api",
"version": "0.1.1",
"version": "0.2.0",
"main": "dist/redux-api.min.js",
"dependencies": {}
}

0 comments on commit 40fda7a

Please sign in to comment.