a-plus-forms
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -34,4 +34,2 @@ 'use strict'; | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -117,55 +115,19 @@ | ||
key: 'waitForServerResponse', | ||
value: function () { | ||
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(request) { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
this.setState({ disabled: true }); | ||
value: function waitForServerResponse(request) { | ||
var _this2 = this; | ||
_context.prev = 1; | ||
_context.next = 4; | ||
return request; | ||
this.setState({ disabled: true }); | ||
case 4: | ||
_context.next = 13; | ||
break; | ||
request.then(function () { | ||
_this2.setState({ disabled: false }); | ||
}).catch(function (error) { | ||
_this2.setState({ disabled: false }); | ||
case 6: | ||
_context.prev = 6; | ||
_context.t0 = _context['catch'](1); | ||
if (!(_context.t0 instanceof _error2.default)) { | ||
_context.next = 12; | ||
break; | ||
} | ||
this.handleErrors(_context.t0.errors); | ||
_context.next = 13; | ||
break; | ||
case 12: | ||
throw _context.t0; | ||
case 13: | ||
_context.prev = 13; | ||
this.setState({ disabled: false }); | ||
this.forceUpdate(); | ||
return _context.finish(13); | ||
case 17: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this, [[1, 6, 13, 17]]); | ||
})); | ||
function waitForServerResponse(_x) { | ||
return _ref3.apply(this, arguments); | ||
} | ||
return waitForServerResponse; | ||
}() | ||
if (error instanceof _error2.default) { | ||
_this2.handleErrors(error.errors); | ||
} else { | ||
throw error; | ||
} | ||
}); | ||
} | ||
}, { | ||
@@ -172,0 +134,0 @@ key: 'validate', |
{ | ||
"name": "a-plus-forms", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "A+ forms. Would use again", | ||
@@ -5,0 +5,0 @@ "files": [ |
99093
1537