react-cognito-forms
Advanced tools
Comparing version
@@ -115,2 +115,4 @@ 'use strict'; | ||
this.props.onError([err.body]); | ||
this.onChangeRequestState((0, _RequestState.ErrorState)([err.body.message])); | ||
@@ -198,3 +200,15 @@ } | ||
}(_react2.default.Component), _class.propTypes = { | ||
cognitoGatewayHost: _propTypes2.default.string.isRequired | ||
cognitoGatewayHost: _propTypes2.default.string.isRequired, | ||
/** | ||
* onError callback, receives an array of error objects, | ||
* each with at least a message property. The following | ||
* are examples of the error object shape: | ||
* e.g. | ||
* {message: 'Passwords do not match'} | ||
* | ||
* or a gromit error object: | ||
* {message: 'User not invited', name: 'UserNotInvited', code: 400} | ||
*/ | ||
onError: _propTypes2.default.func | ||
}, _class.defaultProps = { | ||
@@ -204,2 +218,5 @@ auth: new _auth2.default(), | ||
return props.children; | ||
}, | ||
onError: function onError(ee) { | ||
return ee; | ||
} | ||
@@ -206,0 +223,0 @@ }, _temp; |
@@ -142,2 +142,6 @@ 'use strict'; | ||
this.props.onError(validationErrors.map(function (message) { | ||
return { message: message }; | ||
})); | ||
if (validationErrors.length > 0) { | ||
@@ -144,0 +148,0 @@ this.props.errors; |
{ | ||
"name": "react-cognito-forms", | ||
"version": "0.22.0", | ||
"version": "0.23.0", | ||
"description": "Forms built using React to handle common AWS Cognito tasks eg. Login, Forgot Password, Signup, Multi Factor Authentication and more", | ||
@@ -5,0 +5,0 @@ "main": "lib/web/index.js", |
2760521
0.03%23206
0.08%