-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added .gitignore, description, Readme
- Loading branch information
Showing
3 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# redux-store-filler | ||
|
||
### Installation | ||
|
||
`redux-store-filler` is available on [npm](https://www.npmjs.com/package/redux-store-filler). | ||
|
||
``` | ||
$ npm install redux-store-filler --save-dev | ||
``` | ||
|
||
Use it with standard Redux store. For more information, consult the [Redux documentation](http://redux.js.org). | ||
|
||
### Simple example of usagei | ||
|
||
1. Add config of your entities schema and API. | ||
|
||
```js | ||
|
||
const schema = { | ||
users: {}, | ||
posts: { | ||
author: "users" | ||
}, | ||
}; | ||
|
||
const api = { | ||
users: { | ||
endpoint: "api/v1/users/", | ||
types: ['USERS_GET', 'USERS_SUCCESS', 'USERS_FAILURE'], | ||
}, | ||
posts: { | ||
endpoint: "api/v1/posts/", | ||
types: ['POSTS_GET', 'POSTS_SUCCESS', 'POSTS_FAILURE'], | ||
}, | ||
}; | ||
|
||
const config = { | ||
schema, | ||
api, | ||
}; | ||
|
||
``` | ||
2. Create reducer and middleware using this config. | ||
```js | ||
import {config} from './config'; | ||
import {configureMiddleware} from 'redux-store-filler'; | ||
import {configureReducer} from 'redux-store-filler'; | ||
const reducer = configureReducer(config); | ||
const middleware = configureMiddleware(config); | ||
``` | ||
3. Use it in your Redux application. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
{ | ||
"name": "redux-store-filler", | ||
"version": "0.1.0", | ||
"description": "Redux middleware to construct objects from flat data in store.", | ||
"repository": "geoolekom/redux-store-filler", | ||
"homepage": "https://github.com/geoolekom/redux-store-filler", | ||
"description": "Redux middleware to get data via API and put it in redux store.", | ||
"main": "src/index.js", | ||
"author": { | ||
"name": "George Komarov", | ||
"email": "[email protected]" | ||
}, | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"dependencies": { | ||
"react-addons-update": "^15.5.2", | ||
"redux-api-middleware": "^1.0.3" | ||
}, | ||
"devDependencies": { | ||
"react-addons-update": "^15.5.2", | ||
"redux-api-middleware": "^1.0.3" | ||
|