Skip to content

Commit

Permalink
REF: Be compatible with enforceActions option of mobx
Browse files Browse the repository at this point in the history
  • Loading branch information
royriojas committed Aug 17, 2018
1 parent 74cfa8f commit d419fba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Field.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export default class Field {
// eslint-disable-next-line consistent-return
return new Promise(resolve => {
res.then(
res_ => {
action(res_ => {
// if the function returned a boolean we assume it is
// the flag for the valid state
if (typeof res_ === 'boolean') {
Expand All @@ -319,12 +319,12 @@ export default class Field {

this.errorMessage = '';
resolve(); // we use this to chain validators
},
(errorArg = {}) => {
}),
action((errorArg = {}) => {
const { error, message } = errorArg;
this.errorMessage = (error || message || '').trim() || this._originalErrorMessage;
resolve(); // we use this to chain validators
},
}),
);
});
}
Expand Down

0 comments on commit d419fba

Please sign in to comment.