Skip to content

Commit 6edf093

Browse files
committed
Updated MakeAsyncFunction to accept an ActionMatcher on resolve and reject
Update and reflect changes of redux-promise-listener 1.1.0
1 parent 5e7821f commit 6edf093

File tree

5 files changed

+48
-30
lines changed

5 files changed

+48
-30
lines changed

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ Most of the popular React form libraries accept an `onSubmit` function that is e
1919

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

22-
* [Usage](#usage)
23-
* [Step 1](#step-1)
24-
* [Step 2](#step-2)
25-
* [API](#api)
26-
* [`MakeAsyncFunction: React.Component<Props>`](#makeasyncfunction-reactcomponentprops)
27-
* [Types](#types)
28-
* [`Props`](#props)
29-
* [`start: string`](#start-string)
30-
* [`resolve: string`](#resolve-string)
31-
* [`reject: string`](#reject-string)
32-
* [`setPayload?: (action: Object, payload: any) => Object`](#setpayload-action-object-payload-any--object)
33-
* [`getPayload?: (action: Object) => any`](#getpayload-action-object--any)
34-
* [`getError?: (action: Object) => any`](#geterror-action-object--any)
22+
- [Usage](#usage)
23+
- [Step 1](#step-1)
24+
- [Step 2](#step-2)
25+
- [API](#api)
26+
- [`MakeAsyncFunction: React.Component<Props>`](#makeasyncfunction-reactcomponentprops)
27+
- [Types](#types)
28+
- [`Props`](#props)
29+
- [`start: string`](#start-string)
30+
* [`resolve: string | ActionMatcher`](#resolve-string--actionmatcher)
31+
* [`reject: string | ActionMatcher`](#reject-string--actionmatcher)
32+
- [`setPayload?: (action: Object, payload: any) => Object`](#setpayload-action-object-payload-any--object)
33+
- [`getPayload?: (action: Object) => any`](#getpayload-action-object--any)
34+
- [`getError?: (action: Object) => any`](#geterror-action-object--any)
3535

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

package-lock.json

+24-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"react-dom": "^16.4.1",
5858
"react-redux": "^5.0.7",
5959
"redux": "^4.0.0",
60-
"redux-promise-listener": "^1.0.0",
60+
"redux-promise-listener": "^1.1.0",
6161
"rollup": "^0.63.5",
6262
"rollup-plugin-babel": "^3.0.7",
6363
"rollup-plugin-commonjs": "^9.1.4",
@@ -68,7 +68,7 @@
6868
},
6969
"peerDependencies": {
7070
"redux": ">=3.0.0",
71-
"redux-promise-listener": ">=1.0.0",
71+
"redux-promise-listener": ">=1.1.0",
7272
"prop-types": "^15.6.0",
7373
"react": "^15.3.0 || ^16.0.0",
7474
"react-redux": ">=5.0.0"

src/MakeAsyncFunction.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export default class MakeAsyncFunction extends React.Component<Props, State> {
2323
children: PropTypes.func.isRequired,
2424
listener: PropTypes.object.isRequired,
2525
start: PropTypes.string.isRequired,
26-
resolve: PropTypes.string.isRequired,
27-
reject: PropTypes.string.isRequired,
26+
resolve: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired,
27+
reject: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired,
2828
setPayload: PropTypes.func,
2929
getPayload: PropTypes.func,
3030
getError: PropTypes.func

src/index.js.flow

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
// @flow
22
import * as React from 'react'
3-
import type { SetPayload, GetPayload } from 'redux-promise-listener'
3+
import type {
4+
SetPayload,
5+
GetPayload,
6+
ActionMatcher
7+
} from 'redux-promise-listener'
48

59
type Props = {
610
start: string,
7-
resolve: string,
8-
reject: string,
11+
resolve: string | ActionMatcher,
12+
reject: string | ActionMatcher,
913
setPayload?: SetPayload,
1014
getPayload?: GetPayload,
1115
getError?: GetPayload

0 commit comments

Comments
 (0)