Skip to content

Commit

Permalink
Updated MakeAsyncFunction to accept an ActionMatcher on resolve and r…
Browse files Browse the repository at this point in the history
…eject

Update and reflect changes of redux-promise-listener 1.1.0
  • Loading branch information
lutangar committed Nov 21, 2018
1 parent 5e7821f commit 9eb63ab
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 30 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ Most of the popular React form libraries accept an `onSubmit` function that is e

<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

* [Usage](#usage)
* [Step 1](#step-1)
* [Step 2](#step-2)
* [API](#api)
* [`MakeAsyncFunction: React.Component<Props>`](#makeasyncfunction-reactcomponentprops)
* [Types](#types)
* [`Props`](#props)
* [`start: string`](#start-string)
* [`resolve: string`](#resolve-string)
* [`reject: string`](#reject-string)
* [`setPayload?: (action: Object, payload: any) => Object`](#setpayload-action-object-payload-any--object)
* [`getPayload?: (action: Object) => any`](#getpayload-action-object--any)
* [`getError?: (action: Object) => any`](#geterror-action-object--any)
- [Usage](#usage)
- [Step 1](#step-1)
- [Step 2](#step-2)
- [API](#api)
- [`MakeAsyncFunction: React.Component<Props>`](#makeasyncfunction-reactcomponentprops)
- [Types](#types)
- [`Props`](#props)
- [`start: string`](#start-string)
- [`resolve: string | ActionMatcher`](#resolve-string--actionmatcher)
- [`reject: string | ActionMatcher`](#reject-string--actionmatcher)
- [`setPayload?: (action: Object, payload: any) => Object`](#setpayload-action-object-payload-any--object)
- [`getPayload?: (action: Object) => any`](#getpayload-action-object--any)
- [`getError?: (action: Object) => any`](#geterror-action-object--any)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down
34 changes: 24 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-promise-listener": "^1.0.0",
"redux-promise-listener": "^1.1.0",
"rollup": "^0.63.5",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-commonjs": "^9.1.4",
Expand All @@ -68,7 +68,7 @@
},
"peerDependencies": {
"redux": ">=3.0.0",
"redux-promise-listener": ">=1.0.0",
"redux-promise-listener": ">=1.1.0",
"prop-types": "^15.6.0",
"react": "^15.3.0 || ^16.0.0",
"react-redux": ">=5.0.0"
Expand Down
4 changes: 2 additions & 2 deletions src/MakeAsyncFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export default class MakeAsyncFunction extends React.Component<Props, State> {
children: PropTypes.func.isRequired,
listener: PropTypes.object.isRequired,
start: PropTypes.string.isRequired,
resolve: PropTypes.string.isRequired,
reject: PropTypes.string.isRequired,
resolve: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired,
reject: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired,
setPayload: PropTypes.func,
getPayload: PropTypes.func,
getError: PropTypes.func
Expand Down
10 changes: 7 additions & 3 deletions src/index.js.flow
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// @flow
import * as React from 'react'
import type { SetPayload, GetPayload } from 'redux-promise-listener'
import type {
SetPayload,
GetPayload,
ActionMatcher
} from 'redux-promise-listener'

type Props = {
start: string,
resolve: string,
reject: string,
resolve: string | ActionMatcher,
reject: string | ActionMatcher,
setPayload?: SetPayload,
getPayload?: GetPayload,
getError?: GetPayload
Expand Down

0 comments on commit 9eb63ab

Please sign in to comment.