Skip to content

Commit

Permalink
Remove onResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
dpikt committed Sep 12, 2017
1 parent 7e77101 commit 7ed65d6
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 210 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": [ "es2015", "stage-1", "react" ]
"presets": [ "es2015", "stage-1" ]
}
4 changes: 0 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@
sourceType: module
ecmaFeatures:
experimentalObjectRestSpread: true
jsx: true
impliedStrict: true
plugins:
- react
globals:
Symbol: true
extends:
- eslint:recommended
- plugin:react/recommended
- plugin:import/errors
- plugin:import/warnings
34 changes: 0 additions & 34 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
- [middleware](#middleware)
- [Actions](#actions)
- [Middleware configuration](#middleware-configuration)
- [onResponse](#onresponse)
- [reducer](#reducer)
- [requestWithKey](#requestwithkey)
- [selectors](#selectors)
Expand Down Expand Up @@ -95,39 +94,6 @@ The following options can be used to configure the middleware:
- `failureDataPath`: A path to response data that will be passed as the failure action's payload
- any options used by the lp-requests [http](https://github.com/LaunchPadLab/lp-requests/blob/master/docs.md#http) module

## onResponse

A function that returns a React HOC to handle rendering that depends on an API response.
A combination of [selectors](#selectors) and `onLoad` from `lp-utils`.

**Parameters**

- `requestKeys` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array))?= \[]** A key or set of keys corresponding to `lp-redux-api` requests.
- `LoadingComponent` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)?** A component to render during the loading state. (optional, default `null`)

**Examples**

```javascript
import { REQ_USERS, requestUsers } from 'actions'

function MyComponent (name) {
return (
<p>{name}</p>
)
}

export default compose(
onMount(requestUsers),
onResponse(REQ_USERS),
)(MyComponent)

// requestUsers() dispatches an LP_API action with key 'REQ_USERS' on component mount.
// When the status of 'REQ_USERS' request becomes 'success' or 'failure', the component will render.
// Otherwise, the default `onLoad` loading component will be rendered.
```

Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** A higher order component (HOC).

## reducer

Stores the status of API requests in your state.
Expand Down
15 changes: 3 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "redux middleware and api library",
"main": "lib/index.js",
"scripts": {
"start": "yarn run build:development",
"start": "yarn install && yarn run build:development",
"build": "mkdir -p lib && babel src --out-dir lib --no-comments --minified",
"build:development": "mkdir -p lib && babel src --watch --out-dir lib",
"clean": "rimraf lib",
Expand Down Expand Up @@ -43,32 +43,23 @@
"babel-preset-stage-1": "^6.22.0",
"codeclimate-test-reporter": "^0.4.1",
"documentation": "^4.0.0-beta.18",
"enzyme": "^2.8.2",
"eslint": "^3.15.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-react": "^6.10.3",
"husky": "^0.13.3",
"jest": "^19.0.2",
"react": "^15.5.4",
"react-addons-test-utils": "^15.5.1",
"react-dom": "^15.5.4",
"react-test-renderer": "^15.5.4",
"redux": "^3.6.0",
"redux-mock-store": "^1.2.3",
"rimraf": "^2.5.4"
},
"dependencies": {
"@launchpadlab/lp-utils": "^2.15.0",
"babel-preset-react": "^6.24.1",
"es6-symbol": "^3.1.1",
"humps": "^2.0.0",
"isomorphic-fetch": "^2.2.1",
"js-cookie": "^2.1.3",
"lodash": "^4.17.4",
"react-redux": "^5.0.4"
"lodash": "^4.17.4"
},
"peerDependencies": {
"@launchpadlab/lp-requests": "^2.0.0",
"react": "^15.5.0"
"@launchpadlab/lp-requests": "^2.0.0"
}
}
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export {
} from './actions'
export { default as LP_API } from './LP_API'
export { default as middleware } from './middleware'
export { default as onResponse } from './on-response'
export { default as reducer } from './reducer'
export { default as requestWithKey } from './request-with-key'
export { default as selectors } from './selectors'
Expand Down
49 changes: 0 additions & 49 deletions src/on-response.js

This file was deleted.

1 change: 0 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export { default as unset } from 'lodash/fp/unset'
export { default as compose } from 'lodash/fp/compose'
export { default as union } from 'lodash/union'

export { onLoad, omitProps, deprecate } from '@launchpadlab/lp-utils'
export {
configureHttp,
HttpError,
Expand Down
108 changes: 0 additions & 108 deletions test/on-response.test.js

This file was deleted.

0 comments on commit 7ed65d6

Please sign in to comment.