Skip to content

Commit

Permalink
Move away from async
Browse files Browse the repository at this point in the history
  • Loading branch information
NewOldMax committed Feb 4, 2021
1 parent ce3aeb7 commit 13c1aed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-form-validator-core",
"version": "1.1.0",
"version": "1.1.1",
"description": "Core validator component for react forms.",
"main": "./lib/index.js",
"scripts": {
Expand Down
13 changes: 7 additions & 6 deletions src/ValidatorForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,14 @@ class ValidatorForm extends React.Component {
)

validate = (input, includeRequired, dryRun) => (
new Promise(async (resolve) => {
new Promise((resolve) => {
const { value } = input.props;
const valid = await input.validate(value, includeRequired, dryRun);
if (!valid) {
this.errors.push(input);
}
resolve(valid);
input.validate(value, includeRequired, dryRun).then((valid) => {
if (!valid) {
this.errors.push(input);
}
resolve(valid);
});
})
)

Expand Down

0 comments on commit 13c1aed

Please sign in to comment.